Le 28/10/2011 10:01, Steven D'Aprano a écrit :
didn't think of it. This is hardly a surprise. Wanting to add arbitrary
attributes to built-ins is not exactly an everyday occurrence.
Depends. Experimented programmers don't even think of it. But less
advanced programmers can consider of it. It's is not uncommun to use a
Python class like a C structure, for instance :
class C:pass
C.member1=foo
C.member2=bar
Why not with a built-in type instead of a custom class?
the natural logarithm of a googol (10**100). But it's a safe bet that
nothing so arbitrary will happen.
betting when programming ? How curious! ;)
Also, keep in mind the difference between a *class* __dict__ and an
*instance* __dict__.
You mean this distinction
>>> hasattr('', '__dict__')
False
>>> hasattr(''.__class__, '__dict__')
True
>>>
?
--
http://mail.python.org/mailman/listinfo/python-list