A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067358.html below:

[Python-Dev] Explicit Lexical Scoping (pre-PEP?)

[Python-Dev] Explicit Lexical Scoping (pre-PEP?) [Python-Dev] Explicit Lexical Scoping (pre-PEP?)Jeremy Hylton jeremy at alum.mit.edu
Thu Jul 13 18:14:50 CEST 2006
On 7/12/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Boris Borcic wrote:
>
> >> note that most examples of this type already work, if the target type is
> >> mutable, and implement the right operations:
> >>
> >>       def counter(num):
> >>           num = mutable_int(num)
> >>           def inc():
> >>               num += 1
> >>               return num
> >>           return inc
> >
> > I agree with you (and argued it in "scopes vs augmented assignment vs sets"
> > recently) that mutating would be sufficient /if/ the compiler would view
> > augmented assignment as mutations operators
>
> feel free to replace that += with an .add(1) method call; the point
> wasn't the behaviour of augmented assigment, the point was that that the
> most common use pattern involves *mutation* of the target object.
>
> the syntax isn't that important, really.

Mutation is different from rebinding.  A tuple is immutable, but you
can rebind the variable that refers to the tuple.  I think we will
confuse users if we use the term mutation to refer to name binding.
Name binding is already a subtle issue, so I think the risk is
significant.

Jeremy
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4