(no subject)

Hamish Lawson hbl at st-andrews.ac.uk
Fri Aug 9 16:48:55 CEST 2002


Jarno J Virtanen wrote:

 > The main difference in my Python implementation and their Perl
 > implementation being that I couldn't (and perhaps shouldn't) translate
 > the extremely non-verbose statement in Perl, namely
 >
 >     push(@{$statetab{$w1}{$w2}}, $_);
 >
 > as verbatim to Python.

You can do it with this:

     statetab.setdefault(w1, {}).setdefault(w2, []).append(item)

Whether you should, I leave to your discretion. :-)


Hamish







More information about the Python-list mailing list