[docs] Bug in description of namespaces and scopes

Sandro Tosi sandro.tosi at gmail.com
Sat Mar 31 16:13:07 CEST 2012


Hello Dmitry,

On Tue, Mar 27, 2012 at 10:42, Dmitry Mugtasimov <dmugtasimov at gmail.com> wrote:
> --------------------
>> namespace is a mapping from names to objects
>> scope is textual region
>> scope owns namespaces
>> scope contains names
>> scope is the namespace
> --------------------
> scope is textual region which owns namespaces and scope contains names
> scope is a mapping from names to objects
> textual region == a mapping from names to objects ?

It's hard to follow your reasoning, since you're assuming some
conclusions which are not exactly true.

A namespace is a way to associate a piece of code to a name when you
write your program. As mentioned in the tutorial, asb() is a built-in
name which is associated to python code (object) that gets invoked
when the interpreter find the name abs in your program.

a scope is a part of your code, that defines some rules about how
namespaces are looked up to return an object upon invocation. What
happens if you're defining a new abs() function in your program and
then call it? is it the one used or the built-in one? and what if you
do that in a module ? and in a class (so abs becomes a method of that
class)?

try to experiment a bit with those definition: this will probably
clarify your doubts a bit. Maybe it is worth to contact
mail.python.org/mailman/listinfo/python-list for further guidance too.

> Please, take it seriously. Absence of strict description does not allow full
> understanding of the language and its advanced usage.

why shouldn't we be taking this seriously? We try to do our best, but
we're definitely open to suggestions and improvements (but in this
case, it's probably better if you propose an explicit alternate text
to be used)

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


More information about the docs mailing list