[Python-ideas] Keyword same in right hand side of assignments (rev)

Lie Ryan lie.1296 at gmail.com
Wed Mar 18 03:27:26 CET 2009

Jacob Holm wrote:
> What is wrong is that it computes (n+1) twice, and it uses a different 
> operator to avoid doing the __getitem__ twice. The whole point of the 
> exercise was to get as close as possible to what I think the expression 
> using "same" should mean. I tried to follow the common style for that 
> kind of expansion as seen elsewhere on this list to make that clear. 
> Obviously I failed.

Unless in a very tight loop, I see no reason why computing n+1 and 
__getitem__ twice is a problem. And using temporary variable is 
sufficiently clear enough unless your temporary variable's name starts 
with _.

More information about the Python-ideas mailing list