Why is "while" ticking me off???

Adam Sampson ats1 at ukc.ac.uk
Mon Oct 9 18:34:36 EDT 2000


aahz at panix.com (Aahz Maruch) writes:

> In article <87zokes2wc.fsf at cartman.azz.net>,
> Adam Sampson  <ats1 at ukc.ac.uk> wrote:
> >
> >How about adding a "set to" operator?
> >
> >if a := dict[k1]:
> >	a.something()
> 
> See dict.setdefault() in the Python 2.0 documentation.

I wasn't being serious, but dict.setdefault() is backwards from what I
was intending there. If = were an operator in Python with the same
meaning it has in C, then you could have written that as:

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

-- 

Adam Sampson
azz at gnu.org



More information about the Python-list mailing list