dict1 < dict2 <=> len(dict1) <= len(dict2) ?
Thorsten Kampe
thorsten at thorstenkampe.de
Sat Oct 19 10:22:12 EDT 2002
More information about the Python-list mailing list
Sat Oct 19 10:22:12 EDT 2002
- Previous message (by thread): dict1 < dict2 <=> len(dict1) <= len(dict2) ?
- Next message (by thread): dict1 < dict2 <=> len(dict1) <= len(dict2) ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
* Tim Peters > [Thorsten Kampe] >> #v+ >> if dict0 > dict1: # loop through the shorter dict > > Obvious is better than obscure: > > if len(dict0) > len(dict1): > > is what you mean, so why not just say so? You're not saving any > measurable time by being tricky here, and, to the contrary, if the > lengths happen to be the same, it can be unboundedly slower to > compare the dicts by value instead of by length. You're right. I changed the code, it was an inadequate desire for brevity. Thorsten
- Previous message (by thread): dict1 < dict2 <=> len(dict1) <= len(dict2) ?
- Next message (by thread): dict1 < dict2 <=> len(dict1) <= len(dict2) ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list