From: Antoine Pitrou Date: Sat, 3 Dec 2011 22:08:57 +0000 (+0100) Subject: Streamline mention of sorted() X-Git-Tag: v3.2.3rc1~319 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dec0f21efcdd931bd10ccb8f41809de2e9284cee;p=python Streamline mention of sorted() --- diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index d215ab132c..e45aaaacb6 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]...