"Don't rebind built-in names*" - it confuses readers

Chris Angelico rosuav at gmail.com
Wed Jun 12 20:28:27 EDT 2013


On Thu, Jun 13, 2013 at 10:26 AM, Mark Janssen
<dreamingforward at gmail.com> wrote:
>> There's no point forcing them to be looked up in a two-step process.
>> If you want that, you can simply reference them as
>> __builtins__.whatever, but you can instead just reference them as the
>> unadorned name whatever. They contribute heavily to the simplicity and
>> readability of Python code - imagine if every call to len() had to be
>> qualified.
>
> Well I would anticipate a keyword ("load"?) so one could load a
> particular namespace into the global scope.  The issue I guess is when
> should modules be "on file" vs. "in memory" like the builtins?  The
> reason this is coming up, is because I would like to imagine a data
> ecosystem, where I can import a set of objects from the network as if
> they are local right into my interpreter environment.

The syntax you describe is effectively:

from __builtins__ import *

ChrisA



More information about the Python-list mailing list