| | 64 | |
| | 65 | === No cmp-parameter in sorted === |
| | 66 | |
| | 67 | Python-3 does no longer support the {{{cmp}}} parameter for {{{x.sort()}}} and {{{sorted(x)}}}. We use the {{{key}}} parameter instead. |
| | 68 | |
| | 69 | For locale-sensitive sorting, use the s3compat alternative {{{sorted_locale}}}: |
| | 70 | {{{#!python |
| | 71 | # Python-2 pattern, not working in Python-3: |
| | 72 | x = sorted(x, cmp=locale.strcoll) |
| | 73 | # Python-3 pattern, not working with unicode in Python-2: |
| | 74 | x = sorted(x, key=locale.strxfrm) |
| | 75 | # Compatible pattern: |
| | 76 | from s3compat import sorted_locale |
| | 77 | x = sorted_locale(x) |
| | 78 | }}} |