Closed db091756 closed 3 weeks ago
Very easy fix, will do when #581 is complete
An alternative is to manually insert quotes around annotations where required. I don't care enough to specify one approach or the other. If going for Union
, do make use of Optional
too.
I agree dropping from __future__ import annotations
is a very good idea. See #366, #378 and #515, which will all need updating.
Note that there is a from __future__ import annotations
in coreset.py
, and I can't see why it's still required.
What's the new feature?
Python 3.10 introduced the shorthand
X | Y
to replaceUnion[X, Y]
, until we stop supporting 3.9. we should useUnion
.What value does this add?
to use
|
in versions less than 3.10 we have to usefrom __future__ import annotations
, but all this does is rewrite every type hint likestr | int
to the string"str | int".
This has some issues, see https://stackoverflow.com/questions/66734640/any-downsides-to-using-from-future-import-annotations-everywhere. By explicitly using the "old" Union syntax we avoid this problem.Is there an alternative you've considered?
No response
Additional context
No response