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-July/007286.html below:

[Python-Dev] Features for Python 2.0

[Python-Dev] Features for Python 2.0Thomas Wouters thomas@xs4all.net
Tue, 25 Jul 2000 15:20:44 +0200
On Tue, Jul 25, 2000 at 04:00:07PM +0300, Moshe Zadka wrote:

> OK, here's a possible confusion point in augmented assignments:

> Sometimes

> c = a
> a += b
> assert  a is c

> fails, and sometimes not, depending on a's type. This is just begging
> for trouble. Maybe it will cause massive confusion, maybe it won't. I know
> I'll usually be wary of using it.

In my very honest opinion, that's overstating it a bit. It isn't much more
confusing than the failure of

  c = a + b
  assert c is a + b

for some types, but not for others. Not to mention that

  a + b

can produce an entirely different object than

  b + a

depending on the types. Now, how's that for confusing ! Has anyone ever seen
a problem caused by that ? I haven't, and I doubt the augmented assignment
is going to cause such problems. I *have* seen something like this:

  c = a.extend(b)

Though that was a real silly mistake on the programmers part, and hasn't
repeated itself.

All in all, the only way we are really going to spot these pitfalls,
realistic or not, is by *using* the new syntax, and letting 'newbies' use
it.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!



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