Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3595

Re: Namespaces in functions vs classes

Newsgroups comp.lang.python
Subject Re: Namespaces in functions vs classes
References <mailman.570.1303231664.9059.python-list@python.org>
From "Rhodri James" <rhodri@wildebst.demon.co.uk>
Message-ID <op.vt7grjs4a8ncjz@gnudebst> (permalink)
Organization virginmedia.com
Date 2011-04-19 23:00 +0100

Show all headers | View raw


On Tue, 19 Apr 2011 17:47:40 +0100, Gerald Britton  
<gerald.britton@gmail.com> wrote:

>> Gerald Britton wrote:
>>> I now understand the Python does
>>> not consider a class definition as a separate namespace as it does for
>>> function definitions.  That is a helpful understanding.
>
>> That is not correct.  Classes are separate namespaces -- they just
>> aren't automatically searched.  The only namespaces that are
>> automatically searched are local, non-local, global, and built-in.
>
> I see you misunderstood my observation:  Python does not consider a class
> definition as a separate namespace *as it does* for function definitions.

This phrase normally parses as "Python does not consider a class  
definition as a separate namespace.  In contrast, Python does consider a  
function definition as a separate namespace."  If you meant "Python does  
not consider a class definition as a separate namespace *in the same way*  
that it does for function definitions," saying so would make life easier  
for the fairly large number of readers of this newsgroup whose first  
language isn't English.

Language abuse: it's not just Python.  A donation of just $5 will keep a  
programmer in prepositions for a month.  $50 will supply enough articles  
to keep a small company understandable for over a year.  With your  
generous help, we can beat this scourge!

Ahem.

Normal service will now be resumed.

-- 
Rhodri James *-* Wildebeest Herder to the Masses

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Namespaces in functions vs classes Gerald Britton <gerald.britton@gmail.com> - 2011-04-19 12:47 -0400
  Re: Namespaces in functions vs classes "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2011-04-19 23:00 +0100
    Re: Namespaces in functions vs classes Chris Angelico <rosuav@gmail.com> - 2011-04-20 08:11 +1000
    [OT] Piling of prepositions (was: Namespaces in functions vs classes) Ben Finney <ben+python@benfinney.id.au> - 2011-04-20 09:39 +1000
      Re: [OT] Piling of prepositions (was: Namespaces in functions vs classes) Dave Angel <davea@ieee.org> - 2011-04-19 22:49 -0400
      Re: [OT] Piling of prepositions (was: Namespaces in functions vs classes) geremy condra <debatem1@gmail.com> - 2011-04-19 20:59 -0700

csiph-web