Matthew Wilson wrote: > What are the internal methods that I need to define on any class so that > this code can work? > > c = C("three") > > i = int(c) # i is 3
From Python Reference Manual, section 3.4.7 Emulating numeric types: __complex__( self) __int__( self) __long__( self) __float__( self) Called to implement the built-in functions complex(), int(), long(), and float(). Should return a value of the appropriate type. /MiO -- http://mail.python.org/mailman/listinfo/python-list