C-like assignment expression?
inhahe
inhahe at gmail.com
Wed May 21 12:05:29 EDT 2008
<cokofreedom at gmail.com> wrote in message
news:06ea8b72-598e-4455-b3f9-e614ddb6ad94 at p25g2000hsf.googlegroups.com...
> On May 21, 4:57 pm, "inhahe" <inh... at gmail.com> wrote:
>> one of the few things i miss from C is being able to use assignment in
>> expressions. that's the only thing, really.
>> also there's no switch/case, you have to use a dictionary of functions
>> instead, although i rarely need that, usually i just use elif.
>
> One thing I hate from C is the assignment in expressions...Forcing
> myself to write
> 0 == Something
> rather than
> Something == 0
interesting trick, i've never thought of that/seen it
although if Python implemented it I think it should default to giving
warnings when you use = in an expression, that way you don't have to worry.
> just to make sure I was mistakenly assigning values in statements is
> annoying, it ruins the ease of reading.
>
> I kind of agree with the select:case, but I think a key issue is how
> to implement it. Elif is reasonable for now.
>
> Diez, true I guess, but then we haven't seen what these expressions
> are, and why there has to be three.
More information about the Python-list
mailing list