Having a __stdlib__ namespace?

Daniel Yoo dyoo at hkn.eecs.berkeley.edu
Thu Jan 9 19:15:46 EST 2003


I often find that the modules in my own directory can be misnamed to
conflict with those in the Standard Library.  For example, I might
have a file called 'random.py' in my working directory, which obscures
the Standard Library module.


Would it be a good idea to have a '__stdlib__' module that magically
maps its attributes to only Standard Library modules?  It would act as
a namespace to guarantee access to the standard library, no matter how
weird the sys.path might get.


For example:

###
import __stdlib__.random      ## guarantees that we're using the
                              ## standard library module to look this up
###


I wanted to get some feedback on this before writing a PEP... *grin*




More information about the Python-list mailing list