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

[Enhancement]: opinions on isinstance with tuple or union (|)? #345

Open
jamesbraza opened this issue Jul 1, 2024 · 0 comments
Open

[Enhancement]: opinions on isinstance with tuple or union (|)? #345

jamesbraza opened this issue Jul 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jamesbraza
Copy link

jamesbraza commented Jul 1, 2024

Overview

It turns out with Python 3.10+ that isinstance (docs) supports union syntax:

isinstance(5, (int, str))
isinstance(5, int | str)  # New in Python 3.10

Proposal

Actually I think union syntax is pretty slick, and easier to read. I think it would be a cool refurb rule to suggest this refactor.

What do you think?

@jamesbraza jamesbraza added the enhancement New feature or request label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant