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

Reconsider "not None" versus "or None" for typed object arguments #2696

Open
scoder opened this Issue Nov 1, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@scoder
Contributor

scoder commented Nov 1, 2018

We had discussions at some point about switching from the opt-out "not None" qualifier for object typed function arguments to an opt-in "or None". The rational is that people tend to forget more often than not that None is a valid argument value, and fail to guard their code against it. This also applies to memory views and buffer arguments. Rejecting None and allowing it optionally might be a safer default behaviour.

However, the current default is also the normal Python behaviour. And this feature would then also have to be available in pure Python mode somehow, where None is always a valid value. Both might count as arguments for not changing the behaviour.

@robertwb

This comment has been minimized.

Contributor

robertwb commented Nov 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment