Changes between Version 10 and Version 11 of DeveloperGuidelines/Py_2_3
- Timestamp:
- 06/26/19 19:19:46 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Py_2_3
v10 v11 92 92 ||basestring||{{{from s3compat import basestring}}}|| || 93 93 ||INTEGER_TYPES||{{{from s3compat import INTEGER_TYPES}}}||maps to tuple of all known integer types: (int,long) in Py2, (int,) in Py3), for use with {{{isinstance}}}|| 94 95 === No dict.iteritems === 96 97 Python-3 does not support {{{dict.iteritems()}}}. We use {{{dict.items()}}} instead: 98 99 {{{#!Python 100 # Deprecated 101 for x, y in d.iteritems(): 102 # Accepted 103 for x, y in d.items(): 104 }}} 105 106 NB In Python-2, {{{dict.items()}}} returns a list of tuples, but in Python-3 it returns a dict view object that is sensitive to changes of the dict. If a list is required, or the dict is changed inside the loop, the result of {{{dict.items()}}} must be converted into a list explicitly.