Skip to content

Make ZeroDivisionError message more precise when floor-dividing by zero #119057

Closed
@E8zEbo8Luna

Description

@E8zEbo8Luna

Feature or enhancement

Proposal:

try:
  10 // 0
except ZeroDivisionError as e:
  print(e) #returns integer division or modulo by zero

try:
  10 / 0
except ZeroDivisionError as e:
  print(e) #returns integer division by zero

try:
  10 % 0
except ZeroDivisionError as e:
  print(e) #returns integer modulo by zero

When floor dividing by zero the error says "division or modulo" but while (non-floor) dividing by zero or modulo-ing (?) it is more specific saying "division" or "modulo". I would recommend changing this to "floor division" or "division" because it would help with knowing what exactly the error is talking about.

Thank You!

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions