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/2000-June/004677.html below:

[Python-Dev] Augmented assignment

[Python-Dev] Augmented assignment [Python-Dev] Augmented assignmentNeil Schemenauer nascheme@enme.ucalgary.ca
Thu, 15 Jun 2000 16:26:35 -0600
On Thu, Jun 15, 2000 at 11:30:45PM +0200, Peter Funk wrote:
> Augmented assignments are unPythonic because they don't add any new 
> functionality to the language.
[...]
> 	foo[bar()] = foo[bar()] + bar()
> versus
> 	foo[bar()] += bar()

Not quite.  I think with the proposed implementation += could
modify the LHS object in place.  This could be a big performance
win for things like NumPy objects.  OTOH, the same effect can be
achieved with a method call:

    foo[bar()].add(bar())

  Neil



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