Attributes and built-in types

2005-04-01 Thread Dave Opstad
Is it just an implementation limitation that attributes cannot be assigned to instances of internal types? --- >>> x = 4 >>> type(x) >>> class Test(int): ... pass ... >>> y = Test(4) >>> type(y) >>> y.someattr = 10 >>> x.someattr = 10 Traceback (most recent call last)

Re: Attributes and built-in types

2005-04-01 Thread Sidharth
You might find this usefull specifically the stuff on subclassing built-in types. http://www.python.org/2.2/descrintro.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Attributes and built-in types

2005-04-01 Thread "Martin v. Löwis"
Dave Opstad wrote: Is it just an implementation limitation that attributes cannot be assigned to instances of internal types? No, not "just". Some types have a fixed set of attributes by design, whereas others allow addition of attributes. There are several reasons for this design. Performance is