Why is "while" ticking me off???

Adam Sampson ats1 at ukc.ac.uk
Mon Oct 9 06:52:03 EDT 2000


Greg Ewing <see at my.signature> writes:

> Huaiyu Zhu wrote:
> > 
> > if a = dict1[k1]; a:
> >     a.do_something_interesting()
> 
> I don't like that as it stands; it's too hard to read.
> 
> It could perhaps be improved:
> 
>    if a where a = dict1[k1]:
>       a.do_something_interesting()
> 
> except that then the evaluation order is different
> from the reading order.

How about adding a "set to" operator?

if a := dict[k1]:
	a.something()

Hmmm.

-- 

Adam Sampson
azz at gnu.org



More information about the Python-list mailing list