diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-03 22:08:57 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-03 22:08:57 (GMT) |
commit | dec0f21efcdd931bd10ccb8f41809de2e9284cee (patch) | |
tree | 976d868307703985b0ac811f5198f15cd3f74472 /Doc/faq/design.rst | |
parent | c561a9adac579ed88446385775e635da3e55cf83 (diff) | |
download | cpython-dec0f21efcdd931bd10ccb8f41809de2e9284cee.zip cpython-dec0f21efcdd931bd10ccb8f41809de2e9284cee.tar.gz cpython-dec0f21efcdd931bd10ccb8f41809de2e9284cee.tar.bz2 |
Streamline mention of sorted()
Diffstat (limited to 'Doc/faq/design.rst')
-rw-r--r-- | Doc/faq/design.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index d215ab1..e45aaaa 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -625,10 +625,10 @@ order to remind you of that fact, it does not return the sorted list. This way, you won't be fooled into accidentally overwriting a list when you need a sorted copy but also need to keep the unsorted version around. -In Python 2.4 a new built-in function -- :func:`sorted` -- has been added. -This function creates a new list from a provided iterable, sorts it and returns -it. For example, here's how to iterate over the keys of a dictionary in sorted -order:: +If you want to return a new list, use the built-in :func:`sorted` function +instead. This function creates a new list from a provided iterable, sorts +it and returns it. For example, here's how to iterate over the keys of a +dictionary in sorted order:: for key in sorted(mydict): ... # do whatever with mydict[key]... |