No "side effect" assignment!

Martin Maney maney at pobox.com
Fri Sep 19 11:21:52 EDT 2003


Paul Paterson <paulpaterson at users.sourceforge.net> wrote:
> I think that the other drawback is that it only works at the top level of a
> module.

Yeah, it comes back to me now.  So there's still nothing but ugly
and/or dangerous workarounds when you need to use a function's result
in a conditional as well as later on.  Pytho is such a pleasant
language 95% of the time that the nastiness of the corner cases seems
worse than they rationally warrant - or maybe not, since these warts
tend to drop me out of flow and cost a lot more time than just
remebering the way(s) to hack around them.

> I guess you might call "a.f_locals.update(kw)" a no-(side)-effect assignment

Sure 'nuff.  Pity, it was otherwise quite a nice answer to what seems
to be an endlessly recurring issue.

-- 
Although we may never know with complete certainty the identity
of the winner of this year's presidential election, the identity
of the loser is perfectly clear.  It is the nation's confidence
in the judge as an impartial guardian of the law.
 - Justice John Paul Stevens, from his dissenting opinion Dec 12, 2000




More information about the Python-list mailing list