Assignment versus binding

Rustom Mody rustompmody at gmail.com
Tue Oct 4 13:12:10 EDT 2016


On Tuesday, October 4, 2016 at 10:06:00 PM UTC+5:30, Steve D'Aprano wrote:
> On Tue, 4 Oct 2016 09:32 pm, Rustom Mody wrote:
> 
> > Are not the contents of the scope and the shape of the scope different
> > things?
> 
> 
> What does "the shape of the scope" mean?
> 
> Scopes don't have a shape -- they aren't geometric objects. So I'm afraid I
> don't understand what distinction you are trying to make.

Ok I was speaking quasi metaphorically
If you have some non-metaphors please tell!

Take the basic 'content':
x = 1
y = 2
z = 3

A. Occuring exactly as above at module level
B. Occuring exactly as above inside a function
C. Occuring thus
x = 1
foo(2,3)

def foo(y,z):
...

D. 
def foo():
  x = 1
  def bar():
     y, z = 2,3
...

E.
def foo():
  x = 1
  bar(2,3)
  ...

def bar(y,z):
  ...


In A,B,C,D,E at some point there's x,y,z having values (contents) 1,2,3
How do you distinguish them?

I call it the shape of the scope (or environment or bindings or namespace or
...???)

You have a better descriptor for the idea?



More information about the Python-list mailing list