Mar-02-2017, 04:29 AM
(Feb-26-2017, 09:49 AM)buran Wrote:(Feb-26-2017, 03:28 AM)Skaperen Wrote: interesting that self.foo = 1 can create a new attribute in a class instance but setattr() is needed in other cases.What do you mean?
self.foo = 1
and
setattr(self, foo, 1)
would yield the same result
you cannot add a new attribute using the first form, except for methods.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.