Ask Your Question
1

How can you stop warnings from printing?

asked 2013-06-14 17:21:06 +0200

anonymous user

Anonymous

I am writing a quick and dirty poker program in python, and am getting a warning when doing:

def is_there_a_pair(hand,values=False):
    if values: vals = hand
    else:
        vals = [val for (val,suit) in hand]
    for item in arrangements(vals,2):
        if item[0] == item[1]:
            return item

The warning is the following: sagePoker.py:24: DeprecationWarning: Use Arrangements(mset,k).list() instead. See http://trac.sagemath.org/13821 for details.

But if I do the .list() method, I get this error. AttributeError: 'list' object has no attribute 'list'

Which makes me think doing .list() is useless

What do I do to either fix that erro from happening, or stop errors from printing?

edit retag flag offensive close merge delete

Comments

why did you not accept the answer from John?

jack77 gravatar imagejack77 ( 2013-07-16 06:54:59 +0200 )edit

You need to log-in to vote or accept an answer, so, perhaps the user wants to remain anonymous ;)

tmonteil gravatar imagetmonteil ( 2013-07-16 07:04:21 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-06-14 18:14:33 +0200

Did you use arrangements(...).list() or Arrangements(...).list()? You need to use the second of these; the first gives the error that you mentioned.

edit flag offensive delete link more
0

answered 2013-07-16 06:54:28 +0200

jack77 gravatar image

Hello,

you should fix the code as suggested by John, and use

Arrangements(vals,2).list()

instead of

arrangements(vals,2)

but just for completeness, you can force Python to shut up with adding

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-14 17:21:06 +0200

Seen: 1,663 times

Last updated: Jul 16 '13