int.__init__ incompatible in Python 3.3

Ulrich Eckhardt ulrich.eckhardt at
Fri Nov 9 08:56:22 CET 2012

Am 08.11.2012 21:29, schrieb Terry Reedy:
> On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
> <ulrich.eckhardt at> wrote:
>>> On 3.3, it gives me a "TypeError: object.__init__() takes no
>>> parameters". To some extent, this makes sense to me, because the
>>> int subobject is not initialized in __init__ but in __new__. As a
>>> workaround, I can simple drop the parameter from the call.
> Just drop the do-nothing call.

Wait: Which call exactly?

Do you suggest that I shouldn't override __init__? The problem is that I 
need to attach additional info to the int and that I just pass this to 
the class on contstruction.

Or, do you suggest I don't call super().__init__()? That would seem 
unclean to me.

Just for your info, the class mimics a C enumeration, roughly it looks 
like this:

   class Foo(int):
       def __init__(self, value, name):
           super(Foo, self).__init__(value)
  = name

       def __str__(self):

   Foo.AVALUE = Foo(1, 'AVALUE')
   Foo.BVALUE = Foo(2, 'BVALUE')

Note that even though I derive from an immutable class, the resulting 
class is not formally immutable. Maybe exactly that is the thing that 
the developers did not want me to do? I didn't understand all the 
implications in the bug ticket you quoted, to be honest.

Thank you for your time!


More information about the Python-list mailing list