Python dynamic attribute creation
WANG Cong
xiyou.wangcong at gmail.com
Thu Jul 1 11:46:55 EDT 2010
On 07/01/10 23:19, Stephen Hansen <me+list/python at ixokai.io> wrote:
>>
>> As long as setattr() exists in Python, that will be not so ordinary. :)
>
> setattr is perfectly ordinary.
If you think setattr() is as ordinary as a trivial assignment, I will
argue with you, this is personal taste.
However, I think setattr() is a builtin function, using it exposes the
*magic* of metaprogramming (or class-programming, if more correct) at a
first glance.
--
Live like a child, think like the god.
More information about the Python-list
mailing list