Python Idioms?

David Stanek no_spam..python at
Mon Jun 18 21:25:07 EDT 2001

In reading through the Python source code I came across some oddities.  In
some modules, specifically threading, the instance objects are created using
a kind of factory method.
class _X:

def X(*tupArgs, **dicArgs):
    return apply(_X, tupArgs, dicArgs)

When the class could just as easily been named X.  Is there an advantage to
doing things this way?

Also I noticed in the same module:
import sys
_sys = sys
del sys

What does this do?  You still have a reference to the module.  What
difference does it make what the name is.

David Stanek

More information about the Python-list mailing list