dictionary initialization

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


Hi,

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.

Regards,
Weiguang



More information about the Python-list mailing list