dictionary initialization

Batista, Facundo FBatista at uniFON.com.ar
Thu Nov 25 13:54:12 EST 2004


[wgshi at namao.cs.ualberta.ca]

#-     if i in a: a[i] += 1
#-     else: a[i] = 1

a[i] = a.get(i, 0) + 1

I don't like to be non polite, but following the terms of your mail, RTFM.

.	Facundo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20041125/62d9a84c/attachment.html>


More information about the Python-list mailing list