Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy error: defining a Quantity as multiplication of list and unit raises an error #1947

Open
Luna137 opened this issue Mar 4, 2024 · 0 comments

Comments

@Luna137
Copy link

Luna137 commented Mar 4, 2024

With the newest version of pint, running mypy on the following script

import pint

ureg = pint.UnitRegistry()[
unit_of_length: pint.Unit = ureg.m](b: pint.Quantity = [1, 1, 1] * ureg.m)

returns the following error:

error: Incompatible types in assignment (expression has type "list[int]", variable has type "Quantity")  [assignment]
error: Unsupported operand types for * ("list[int]" and "Unit")  [operator]

Is this meant to happen, or is this a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant