How does Mr. Martelli's Borg recipe work ?
Ian Bicking
ianb at colorstudy.com
Wed Jul 23 12:52:07 EDT 2003
On Wed, 2003-07-23 at 02:45, Robin Becker wrote:
> ....can't one do
> class TheSomething:
> ....
>
> TheSomething = TheSomething()
>
> then it's harder to get at the class which presumably is now only
> available as TheSomething.__class__
I wouldn't generally name the class and the singleton the same, but just
because that is confusing -- if you look briefly at the code you'll
initially think that TheSomething is a class, when it is actually an
instance. Better would be:
class _Something:
....
TheSomething = _Something()
del _Something
Ian
More information about the Python-list
mailing list