singleton objects with decorators

Fredrik Lundh fredrik at pythonware.com
Tue Apr 12 07:26:54 EDT 2005


Bengt Richter wrote:

> But isn't bool supposed to be a singleton class/type ?
>
> >>> [bool(x) for x in 0, 0.0, [], {}, False]
> [False, False, False, False, False]
> >>> [id(bool(x)) for x in 0, 0.0, [], {}, False]
> [505014288, 505014288, 505014288, 505014288, 505014288]

"False" is an ordinary global object, not an object factory or a singleton class.

</F> 






More information about the Python-list mailing list