[Python-ideas] list…pushed, or something

Stephen J. Turnbull stephen at xemacs.org
Sat Mar 30 01:12:41 CET 2013


Shane Green writes:

 > Given my recommendation: 
 > 	X.pushed(Y) -> X IFF (and-only-if) Y is X.
 > 
 > However, 
 > 	X.pushed(Y) -> Y is always true.  

FWIW, Steve McConnell (Code Complete) recommends that

    X.pushed(foo())

quite often should be written as

    foo_value = foo()                  # but with a descriptive name!
    X.pushed(foo_value)                # sic, probably pushed -> push?

even if "foo_value" is only used once.  It's not like you save
anything but one line by putting foo() inside the parentheses, it's
just a name binding that is resolved by the compiler anyway.  My
understanding of Guido's decisions is that he agrees with McConnell on
this point.




More information about the Python-ideas mailing list