if <assignment>:

Bengt Richter bokr at oz.net
Thu Nov 28 12:37:27 EST 2002


On Thu, 28 Nov 2002 16:01:55 +1300, Greg Ewing <see_reply_address at something.invalid> wrote:

>Erik Max Francis wrote:
>
>> 
>> I think the severity of the =/== confusion problem in C has been
>> severely overrepresented in this thread.  In my opinon, in the real
>> world, among competent software eengineers, it is a tiny issue.
>
>
>I think it's too simplistic to regard the =/== confusion problem
>as the only reason to be wary of assignments in expressions.
>It also hurts readability to have expressions with assignments
>buried in them.
>
>This is a special case of the general principle that it's
>usually clearer if expressions don't have side effects.
>
OTOH, an expression is a (normally) limited programming context, and
no one seems to have a big problem with the temporary bindings created
inside list comprehensions -- even though they are *not* temporary, and
therefore *are* side effects (which IMO is a wart) ;-)

ISTM it's a question of whether making it syntactically easier is more likely
to encourage bad usage than facilitate and clarify legitimate uses.

BTW, is there anything written on what the BDFL may have in mind for
':=' and '?' and '@' etc for? I'm sure he wouldn't want to squander them
on something trivial, but I wonder if there's some indication. Similarly
for words like "on", "when", "whenever", "before", "after", "initially",
"finally", etc, etc. (is there a don't-use-in-case-this-becomes-special list?
Seems like I saw something like that somewhere).

HTG ;-)

Regards,
Bengt Richter



More information about the Python-list mailing list