[Python-Dev] dict.sortedkeys()
Guido van Rossum
guido at python.org
Sat Apr 17 21:04:43 EDT 2004
> [Bob Ippolito]
> > I'm pretty sure that in Python 2.4 you will be able to say
> sorted(seq).
>
> Excellent! That'll do nicely. :)
Even better, you'll be able to say sorted(iterable), and a dict is an
iterable (yielding its keys), so you can say sorted(dict).
$ ./python
Python 2.4a0 (#93, Mar 31 2004, 10:08:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sorted(sys.modules)
['UserDict', '__builtin__', '__main__', '_codecs', '_sre', 'codecs', 'copy_reg', 'distutils', 'distutils.dep_util', 'distutils.distutils', 'distutils.errors', 'distutils.log', 'distutils.os', 'distutils.re', 'distutils.spawn', 'distutils.string', 'distutils.sys', 'distutils.util', 'encodings', 'encodings.aliases', 'encodings.codecs', 'encodings.exceptions', 'encodings.iso8859_15', 'encodings.types', 'exceptions', 'linecache', 'os', 'os.path', 'posix', 'posixpath', 're', 'readline', 'rlcompleter', 'signal', 'site', 'sre', 'sre_compile', 'sre_constants', 'sre_parse', 'stat', 'string', 'sys', 'types', 'warnings', 'zipimport']
>>>
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list