tough-to-explain Python
Piet van Oostrum
piet at cs.uu.nl
Wed Jul 8 04:11:35 EDT 2009
>>>>> Simon Forman <sajmikins at gmail.com> (SF) wrote:
>SF> Why would you even tell the poor bastards about "+=" before they were
>SF> comfortable with (python's style of) function calls, immutable
>SF> integers, mutable lists and immutable tuples?
>SF> Let them use "x = x + y" until they have enough knowledge to
>SF> understand "augmented" assignment.
And *then* you can tell them that "x += y" can be subtly different from
"x = x + y", which is what happened in the example that the OP gave.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list
mailing list