Skip to content

Instantly share code, notes, and snippets.

@puzzlet
Created November 2, 2012 02:36
Show Gist options
  • Save puzzlet/3998342 to your computer and use it in GitHub Desktop.
Save puzzlet/3998342 to your computer and use it in GitHub Desktop.
The wild world of ZeroDivisionError messages
# Python 2.5 & 2.6
1/0 # ZeroDivisionError: integer division or modulo by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division
1.0%0 # ZeroDivisionError: float modulo
# Python 2.7
1/0 # ZeroDivisionError: integer division or modulo by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division by zero
1.0%0 # ZeroDivisionError: float modulo
# Python 3.1
1/0 # ZeroDivisionError: int division or modulo by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division
1.0%0 # ZeroDivisionError: float modulo
# Python 3.2
1/0 # ZeroDivisionError: division by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division by zero
1.0%0 # ZeroDivisionError: float modulo
# pypy 1.9.0 (Python 2.7.2)
1/0 # ZeroDivisionError: integer division by zero
1%0 # ZeroDivisionError: integer modulo by zero
1.0/0 # ZeroDivisionError: float division
1.0%0 # ZeroDivisionError: float modulo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment