dictionary initialization

Weiguang Shi wgshi at namao.cs.ualberta.ca
Fri Nov 26 12:53:12 EST 2004


Just received an email from Batista, Facundo. Below are some quote and
my reply. 

On Fri, Nov 26, 2004 at 09:09:46AM -0300, Batista, Facundo wrote:
> ... 
>   >>> a = {}
>   >>> a['1'] = 5
>   >>> a['1'] *= 2
>   >>> a['1']
>   10
>   
>   >>> a['1'] = "blah"
>   >>> a['1'] *= 2
>   >>> a['1']
>   'blahblah'
>   
>   >>> a['1'] = ['a', 8]
>   >>> a['1'] *= 2
>   >>> a['1']
>   ['a', 8, 'a', 8]
>   
> The type of the right hand operator does not have nothing to do with
> the
> type of the left operand!
> 

You mean in Python, of course. I can see this is going the religious
direction now.

All in all, I've realized when a language generalizes and abstracts, 
it loses convenience. Because of this, however powerful other
languages become, awk always has its place as long as the application
is there.

Weiguang



More information about the Python-list mailing list