| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Is type(Placeholder)() acceptable? I would have actually expected that type(MySentinel)() returned the sentinel as for type(None)() but it's not the case since MySentinel is an instance of a sentinel! |
Sorry, something went wrong.
|
Actually, since we're launching beta, it may be ok to change this and see if it breaks something |
Sorry, something went wrong.
|
It's difficult to imagine why people would be doing things like type(Placeholder)() outside of test code, but you never know. |
Sorry, something went wrong.
|
I can see people doing type(Placeholder) for maybe their mypy plugin or whatever, or even for checking if a default is a placeholder instance and do something else with it (though they should assume that it's a singleton so there is no real need to check placeholders through isinstance checks). I think there was a discussion when introducing placeholders about type(P)() returning P but I can't find it (and maybe I remembered wrongly). One could argue that type(Placeholder) could also be used for type annotations =/ |
Sorry, something went wrong.
|
This PR is stale because it has been open for 90 days with no activity. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This greatly simplifies the code. The only behavioral difference observable in the tests is that type(Placeholder)() no longer works, because Placeholder is now an instance of sentinel.
📚 Documentation preview 📚: https://cpython-previews--149088.org.readthedocs.build/