Skip to content

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

@scoder

Description

@scoder

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions