[ python-Bugs-1684943 ] Keyword arguments to __init__() of a subclass of set

SourceForge.net noreply at sourceforge.net
Wed Mar 21 07:59:35 CET 2007


Bugs item #1684943, was opened at 2007-03-20 23:50
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1684943&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Jørgen Frøjk Kjærsgaard (jfroejk)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: Keyword arguments to __init__() of a subclass of set

Initial Comment:
Passing a keyword argument to a subclass of the built-in class "set" causes a TypeError in Python 2.4.2 and newer but not in 2.4.0. Example:

class Test(set):
    def __init__(self, a=0):
        self.add(a)

t = Test(a=0)

In Python 2.4.0 it works as expected whereas in 2.4.2 and 2.4.4, it yields:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: set() does not take keyword arguments

I don't pass a keyword argument to set.__init__() but to its subclass!


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-03-20 23:59

Message:
Logged In: YES 
user_id=33168
Originator: NO

2.4 is no longer supported.  This has been fixed in 2.5.  I don't have the
original bug report #.  You can find the fix in SVN if you would like to
build your own patched version.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1684943&group_id=5470


More information about the Python-bugs-list mailing list