[Jeff Epler] > Factor sorted into a function that returns a sorted copy: > def sorted(seq): > seq = list(seq) > seq.sort() > return seq > > or one that sorts in place: > def sorted(seq): > seq.sort() > return seq > > Now you can write your one-liner: > for i in sorted({}.keys()): > ... Yes, of course. But I'm working on a large business app framework. That means either: 1. Writing sorted into every module where it's needed. 2. Putting sorted into a package somewhere, which makes it longer and uglier with absolute referencing. 3. Customizing consumers' Python install. ...none of which are good options. [Bob Ippolito] > I'm pretty sure that in Python 2.4 you will be able to say sorted(seq). Excellent! That'll do nicely. :) -another bob
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