Changes between Version 62 and Version 63 of DeveloperGuidelines/Py_2_3


Ignore:
Timestamp:
07/07/19 10:14:06 (5 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Py_2_3

    v62 v63  
    248248    x = s3_str(x)
    249249}}}
     250
     251=== next(i) not i.next() ===
     252
     253In Python-3 the {{{i.next}}} method of iterators has been renamed into {{{i.__next__}}}, and should not be called explicitly but via the built-in {{{next(i)}}} function.
     254
     255This function is also available in Python-2.7 (where it calls i.next() instead), so we generally use the next function:
     256
     257{{{#!python
     258i = iter(l)
     259# Deprecated:
     260item = i.next()
     261# Forward+backward-compatible way to do it:
     262item = next(i)
     263}}}