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/2009-March/087289.html below:

[Python-Dev] In-place operators

[Python-Dev] In-place operators [Python-Dev] In-place operatorsAntoine Pitrou solipsis at pitrou.net
Tue Mar 17 23:22:00 CET 2009
Raymond Hettinger <python <at> rcn.com> writes:
> 
> I'm sure that consistency/completeness/safe_vs_sorry 
> was the reason they were added.  But, if they aren't useful, 
> they never should have been (IMO).  It wastes the time of 
> people who try to use them and then find-out that they don't 
> act as expected (the assignment doesn't take place)

>>> l = []
>>> operator.iadd(l, [5])
[5]
>>> l
[5]

The operation /does/ occur in-place for mutable types. Yes, the semantics are
non-obvious for non-mutable types, but that doesn't make it completely useless.


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