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
Ior assignment operator is flagged while equivalent __ior__() method call is not #11097
Comments
The statement How is the |
The
I'm pasting a current version of the module. I'm still shaking it out, but it largely works and has
|
I noticed a mistake in my last post. There is an annotation error in the In any case, thanks for investigating this.
|
Bug Report
A
|=
operation statement causes "Result type of | incompatible in assignment" while the equivalent method call is accepted without complaint. I haven't figured out to annotate the statement to prevent that complaint, and expect that the complaint is an error.To Reproduce
I am composing an OrderedSet based on one of Ramond Hettinger's recipes (the weakref one), adding needed functionality and type annotations. As in the recipe, my OrderedSet class is based on
collections.MutableSet
. Adding an update method, this definition results inResult type of | incompatible in assignment
on the "|=" statement:However, code for the method that is identical except for using the corresponding method call instead of the
|=
operator does not cause any complaints:I would prefer to use the
|=
statement, but have been unable to annotate the unaccepted statement in a way that prevents the complaint (short of usingignore
). (There are other methods that suffer from similar obstacles, including the original__init__()
included in Raymond's recipe. The example I'm using involves fewer incidental details.)Expected Behavior
I believe the
|=
statement should be accepted without complaint.Actual Behavior
Result type of | incompatible in assignment
error on the "|=" statement.Your Environment
The text was updated successfully, but these errors were encountered: