On Friday, February 8, 2013 12:25:34 AM UTC-6, Chris Angelico wrote:
> On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson wrote:
> > It is my strong opinion that all "unqualified" variables must be local to 
> > the containing block, func/meth, class, or module. To access any variable 
> > outside of the local scope a programmer MUST qualify that variable with the 
> > func, class, or module identifiers. Consider the following examples
> 
> Okay. Now start actually working with things, instead of just making
> toys. All your builtins now need to be qualified:
    
Chris you are very trollish, and a total tool of Deaprano, but you are damn 
funny sometimes and for that reason i still respond to you. ;-)

> __builtins__.print("There
> are",__builtins__.len(self.some_list),"members in this list,
> namely:",__builtins__.repr(self.some_list))

That's funny, and i laughed whilst reading it, but i do have to admit that i 
did not explain this detail. IMHO, all builtins should not be auto-imported, 
the programmer should import them either on a case by case basis, or do the 
global import:

     from builtins import print, len, repr
     from builtins import *  # This is not recommended!

This would serve two purposes (1) the reader would know which builtins where 
being used in this module (2) the names would be bound properly to the module 
namespace. But this does not answer your question, merely a side note

So your assertion is wrong. Built-ins /would/ be available at the module level 
with no qualification just as they are now. But they would also be available in 
/every/ namespace because how else would we use them Chris? 

It's very simple, when python encounters a unqualified symbol, it looks first 
for a match in the built-in symbols array, and if not match is found it then 
raises a NameError.

> Or are you going to make builtins and imports magically available as
> PHP-style superglobals?

Hmm, what are they now Chris? Python built-ins are known everywhere without 
qualification and require no import. I think super-global about sums it up.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to