dictionary initialization

Weiguang Shi wgshi at namao.cs.ualberta.ca
Thu Nov 25 22:22:22 CET 2004


In article <opsh1wxfkx1js0xs at news.telkomsa.net>, Caleb Hattingh wrote:
> ...
>  ***
>  # You *must* use a={}, just start as below
>  '>>> a={}
Yeah I know. I can live with that.

>  '>>> a['1']=0
>  '>>> a['1']+=1
Right here. You have to say a['1'] = 0 before you can say a['1'] +=1
Python does not do the former for you. That's what I'm asking
justifications for.


More information about the Python-list mailing list