On Sun, 08 Nov 2009 13:20:23 -0800, webtourist wrote:

> New bie Question:
> in "Zen of Python" - what exactly does the last one mean ? - Namespaces
> are one honking great idea -- let's do more of those!
> 
> I mean why the emphasis ? Is it like saying "put modules into packages"
> in other programming paradigm s ?

Modules are namespaces. So are packages.

Classes and class instances are namespaces.

Even function scopes are namespaces. When you write:


n = None

def spam(n):
    print "spam" * n

def ham(n):
    print "ham" * n

the n inside spam() and ham() and the global n are in different 
namespaces, and so independent.


http://en.wikipedia.org/wiki/Namespace
http://docs.python.org/tutorial/classes.html#python-scopes-and-namespaces


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to