object as a reserved keyword

Pedro Werneck pedro.werneck at bol.com.br
Sun Jul 20 10:35:52 EDT 2003


Lawrence Oluyede <raims at dot.com> wrote in message 
> Yeah, thanks. Is this kind of idea that I'm not used to

I remember seeing a piece like this on a discussion about abusive code:

>>> class Sum(type):
...     def __new__(meta, name, bases, dict):
...             return sum(bases)
... 
>>> class blah(1, 2, 3, 4, 5):
...     __metaclass__ = Sum
... 
>>> blah
15
>>> type(blah)
<type 'int'>
>>>

It's weird to have the freedom to do that... isn't Python great ?




More information about the Python-list mailing list