magical expanding hash

braver deliverable at gmail.com
Thu Jan 19 02:35:26 CET 2006


Giovanni Bajo wrote,
> dict.setdefault, as I already explained to you.

 I wonder about numerics too.  Say we have a = None somewhere.

I want to increment it, so I'd say a += 8.  Now if this is a parsing
app, the increment may happen everywhere -- so I'd write a function to
do it if I worry about it being initialized before.  Is there any
operator/expression level support for what in ruby looks like

a ||= 0




More information about the Python-list mailing list