Re: Namespacedifference reading - writing ??

Discussion in 'Python' started by Steven Taschuk, Jun 27, 2003.

  1. Quoth Peter Abel:
    [...]
    > Is there really a difference in namespacehandling depending
    > on writing or reading variables?


    Yes. Assigned-to variables are local; variables merely referred
    to may be found in nested scopes.

    "When a name is used in a code block, it is resolved using the
    nearest enclosing scope. [...] If a name is bound in a block, it
    is a local variable of that block. [...] If a name binding
    operation occurs anywhere within a code block, all uses of the
    name within the block are treated as references to the current
    block. [...] The local variables of a code block can be determined
    by scanning the entire text of the block for name binding
    operations."
    <http://www.python.org/doc/current/ref/naming.html>

    (Note that defs and whatnot are also name-binding operations.)

    --
    Steven Taschuk w_w
    ,-= U
    1 1
     
    Steven Taschuk, Jun 27, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pieter Hulshoff
    Replies:
    0
    Views:
    1,066
    Pieter Hulshoff
    Aug 13, 2003
  2. Chris Pruett
    Replies:
    0
    Views:
    1,441
    Chris Pruett
    Aug 14, 2003
  3. Modukuri
    Replies:
    0
    Views:
    2,948
    Modukuri
    May 19, 2004
  4. HNguyen
    Replies:
    4
    Views:
    2,453
    HNguyen
    Dec 21, 2004
  5. Duncan Booth
    Replies:
    0
    Views:
    669
    Duncan Booth
    Jun 27, 2003
Loading...

Share This Page