Re: setattr() on "object" instance

2009-03-25 Thread Aahz
In article <33f40372-13fb-4d52-921d-8ab00685c...@q30g2000prq.googlegroups.com>, Sean DiZazzo wrote: > >Why is it that you can setattr() on an instance of a class that >inherits from "object", but you can't on an instance of "object" >itself? > o = object() setattr(o, "x", 1000) >Traceba

setattr() on "object" instance

2009-03-16 Thread R. David Murray
Sean DiZazzo wrote: > Why is it that you can setattr() on an instance of a class that > inherits from "object", but you can't on an instance of "object" > itself? > > >>> o = object() > >>> setattr(o, "x", 1000) > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'obje

Re: setattr() on "object" instance

2009-03-16 Thread Duncan Booth
Ahmad Syukri b wrote: > On Mar 16, 1:21 pm, Sean DiZazzo wrote: >> Why is it that you can setattr() on an instance of a class that >> inherits from "object", but you can't on an instance of "object" >> itself? >> >> >>> o = object() >> >>> setattr(o, "x", 1000) >> >> Traceback (most recent call

Re: setattr() on "object" instance

2009-03-15 Thread Ahmad Syukri b
On Mar 16, 1:21 pm, Sean DiZazzo wrote: > Why is it that you can setattr() on an instance of a class that > inherits from "object", but you can't on an instance of "object" > itself? > > >>> o = object() > >>> setattr(o, "x", 1000) > > Traceback (most recent call last): >   File "", line 1, in >

setattr() on "object" instance

2009-03-15 Thread Sean DiZazzo
Why is it that you can setattr() on an instance of a class that inherits from "object", but you can't on an instance of "object" itself? >>> o = object() >>> setattr(o, "x", 1000) Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'x' >>> cl