Ask Your Question

How can you stop warnings from printing?

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

anonymous user


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
        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: DeprecationWarning: Use Arrangements(mset,k).list() instead. See 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


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

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

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

jack77 gravatar image


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


instead of


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


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

Seen: 1,705 times

Last updated: Jul 16 '13