On Mar 17, 7:08 pm, "Dominik Jain" <[EMAIL PROTECTED]> wrote: > Hi! > > Does anyone know how an instance of a (new-style) class can be created > without having to call the constructor (and providing the arguments it > requires)? With old-style classes, this was possible using new.instance. > Surely there must be a simple way to do this with new-style classes, too -- > or else how does pickle manage? > > Best, > Dominik
>>> class C: pass ... >>> object.__new__( C ) <__main__.C object at 0x00B5ED70> And for the record: >>> class C: ... def __init__( self ): ... print( 'in init' ) ... >>> C() in init <__main__.C object at 0x00B5ED90> >>> object.__new__( C ) <__main__.C object at 0x00B5EE30> >>> type( C.__name__, (), dict( C.__dict__ ) )() in init <__main__.C object at 0x00B5ED90> Which is kind of biza-a-r-rre. -- http://mail.python.org/mailman/listinfo/python-list