You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See title. Linter rule UP007 tries to change Optional[T] into T | None and I think that the Optional[T] syntax is better. This is a residual from before Optional was possible.
The rule was originally to detect Union[T,None] and recommend T | None. I concur that T | None is better than using Union but Optional should be preferred to both. Until the linter rule is updated (there is an issue about this topic here) I recommend we add UP007 to our exclude list.
The text was updated successfully, but these errors were encountered:
Refer to discussion in #337. Closing issue for now. Keeping the rule enabled results in one valid way to write the type hint in question, disabling the rule results in three valid ways to write it.
T | None is the path forward until UP007 can be amended to account for Optional[T] patterns.
See title. Linter rule UP007 tries to change
Optional[T]
intoT | None
and I think that theOptional[T]
syntax is better. This is a residual from beforeOptional
was possible.The rule was originally to detect
Union[T,None]
and recommendT | None
. I concur thatT | None
is better than usingUnion
butOptional
should be preferred to both. Until the linter rule is updated (there is an issue about this topic here) I recommend we add UP007 to our exclude list.The text was updated successfully, but these errors were encountered: