En Fri, 06 Nov 2009 04:29:05 -0300, Alf P. Steinbach
escribió:
* Gabriel Genellina:
En Thu, 05 Nov 2009 21:23:27 -0300, Alf P. Steinbach
escribió:
foo()[bar()] += 1
One reason was as mentioned that the C++ standard has essentially the
/same wording/ about "only evaluated once" but with
* Gabriel Genellina:
En Thu, 05 Nov 2009 21:23:27 -0300, Alf P. Steinbach
escribió:
[snip]
From the docs for the operator module: "Many operations have an
“in-place” version. The following functions provide a more primitive
access to in-place operators than the usual syntax does; for examp
En Thu, 05 Nov 2009 21:23:27 -0300, Alf P. Steinbach
escribió:
* Jon Clements:
This sent me searching everywhere, because the documentation of '+=' and
other "augmented assignment statements" says
"The target is only evaluated once.",
like in C++, which implies a kind of reference to
* Jon Clements:
I read the OP as homework (I'm thinking Scott did as well),
Sorry. Need to recalibrate that neural network. Back-propagation initiated...
Done! :-)
however,
your code would be much nicer re-written using collections.defaultdict
(int)... which I don't think is giving anythi