Proposal: add sys to __builtins__

Patrick Maupin pmaupin at gmail.com
Tue Sep 6 21:37:53 EDT 2005


Sybren Stuvel wrote:

> A programming language should not be ambiguous. The choice
> between importing a module and calling a function should not
> depend on the availability of a (local) variable.

Yeah, this behavior would be as ambiguous as if we had a system-defined
search-path for modules, where you might get one module or another
depending on the path order.  Oh, wait -- we have one of those.

> The question is not if it's possible or not - in principle, everything
> is possible. The question is if it is desirable.

Exactly.  So it pays to try to understand what the payoff might be, and
I always try to be open-minded about that (although I sometimes fail
miserably in this goal).  In the case of sys.path, the payoff is that a
Python application has a small chance of running on a completely
different system.  In the case of automagic importation, the only
payoff I have seen discussed is that some people would be happier with
a little less typing.

The thing I always find baffling is that people who find it hard to
type "import sys" seem to find it quite easy to write eight paragraphs
explaining why it's bad to have to type "import sys."

Regards,
Pat




More information about the Python-list mailing list