Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dec0f21

Browse files
committed
Streamline mention of sorted()
1 parent c561a9a commit dec0f21

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/faq/design.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ order to remind you of that fact, it does not return the sorted list. This way,
625625
you won't be fooled into accidentally overwriting a list when you need a sorted
626626
copy but also need to keep the unsorted version around.
627627

628-
In Python 2.4 a new built-in function -- :func:`sorted` -- has been added.
629-
This function creates a new list from a provided iterable, sorts it and returns
630-
it. For example, here's how to iterate over the keys of a dictionary in sorted
631-
order::
628+
If you want to return a new list, use the built-in :func:`sorted` function
629+
instead. This function creates a new list from a provided iterable, sorts
630+
it and returns it. For example, here's how to iterate over the keys of a
631+
dictionary in sorted order::
632632

633633
for key in sorted(mydict):
634634
... # do whatever with mydict[key]...

0 commit comments

Comments
 (0)