Sorting distionary by value
Jeff Shannon
jeff at ccvcorp.com
Thu Mar 28 15:01:15 EST 2002
More information about the Python-list mailing list
Thu Mar 28 15:01:15 EST 2002
- Previous message (by thread): Sorting distionary by value
- Next message (by thread): Default arg for dict() (was Re: Sorting distionary by value)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
phil hunt wrote: > IIRC in Awk you can just say: freq[word] ++ and it works > correctly even when there is no pre-existing index of word in freq. > > IMO it's a pity Python isn't like that. I disagree. I'm just as happy that Python doesn't try to guess what would be a suitable "default" value for non-existent keys. It seems to me to be entirely consistent with the philosophy of "explicit is better than implicit". Why presume that somedict[key] should default to 0, instead of to an empty string, or to None, or to [], or... ??? Jeff Shannon Technician/Programmer Credit International
- Previous message (by thread): Sorting distionary by value
- Next message (by thread): Default arg for dict() (was Re: Sorting distionary by value)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list