True, False, None
Andrew Dalke
adalke at mindspring.com
Wed Nov 12 03:32:36 EST 2003
Michele Simionato
> Better to say: singletons are classes. But True and False are not
> classes (no '__base__' attribute, for instance) so they are not
> singletons.
I don't follow your statement.
Not all singletons are classes. Imported modules are
singletons, yes? And as an implementation choice the
numbers -1 to 100 are singletons as are the single character
byte strings. (Implementation choice since the spec requires
that None references a singleton but not that 1 and 3-2
always reference the same object.)
>>> import sys
>>> sys.__base__
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'module' object has no attribute '__base__'
>>> (1).__base__
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'int' object has no attribute '__base__'
>>>
> I think using smallcaps would have been more consistent.
Well, I do too. Just conjecturing.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list