[Python-Dev] Alternate notation for global variable assignments

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Oct 26 23:28:09 EST 2003


> I like Just's := concept except for the similarity to =, and I worry
> that the presence of := in the language will flip people into "Pascal
> mode" -- thinking that = is the equality operator.  I also think that
> the notation is somewhat unnatural -- "globalness" is a property of
> the _variable_, not the operator.  So I'd like to suggest instead
> 
>    :var       = value   # var in module scope
>    :scope:var = value   # var in named enclosing scope

Yeek, that makes it look like Logo!

What about simply

  outer x = value

In this, 'outer' would be an annotation applicable to any
bare name in an lvalue position, so you could say

  (x, outer y, self.z) = stuff

if you wanted, or even

  def outer f():
    ...

  class outer C:
    ...

although probably I wouldn't mind much if those were
disallowed.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list