Am 12.03.11 18:00, schrieb Glenn Linderman: > On 3/12/2011 1:55 PM, Fredrik Johansson wrote: >> Consider sorting a list of pairs representing fractions. This can be >> done easily in Python 2.x with the comparison function lambda >> (p,q),(r,s): cmp(p*s, q*r). In Python 2.6, this is about 40 times >> faster than using fractions.Fraction as a key function. > > Am I correct in concluding that various ideas to eliminate or limit the > size of the key= cache would not help this use case at all? That's correct. However, there is a straight-forward day of getting the same comparison algorithm with the cmp_to_key class in 3.x. Fredrik classified this as "ugly and slow"; I'm not sure where this classification comes from. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4