Skip to main content
Code Review

Return to Question

Bring tags inline with site policy
Link
Peilonrayz
  • 44.4k
  • 7
  • 80
  • 157
edited tags
Link
200_success
  • 145.5k
  • 22
  • 190
  • 479
added 1 character in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Import "izip" for different versions of pythonPython

A common idiom that I use for python2Python2-python3Python3 compatibility is:

try:
 from itertools import izip
except ImportError: #python3.x
 izip = zip

howeverHowever, a comment on one of my stackoverflowStack Overflow answers implies that there may be a better way. Is there a more clean way to accomplish this?

Import "izip" for different versions of python

A common idiom that I use for python2-python3 compatibility is:

try:
 from itertools import izip
except ImportError: #python3.x
 izip = zip

however, a comment on one of my stackoverflow answers implies that there may be a better way. Is there a more clean way to accomplish this?

Import "izip" for different versions of Python

A common idiom that I use for Python2-Python3 compatibility is:

try:
 from itertools import izip
except ImportError: #python3.x
 izip = zip

However, a comment on one of my Stack Overflow answers implies that there may be a better way. Is there a more clean way to accomplish this?

edited tags; edited title
Link
200_success
  • 145.5k
  • 22
  • 190
  • 479
Loading
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
Loading
Source Link
mgilson
  • 223
  • 1
  • 2
  • 7
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /