Skip to content

Should collections containing None require type annotations? #2246

Closed
@ddfisher

Description

@ddfisher

Currently, collections containing only None require type annotations (in strict Optional -- they're meaningless otherwise). For example:

x = [None]  # E: Need type annotation for variable

As @dmoisset mentioned in #2230, this can be confusing. We should consider whether or not we really want to require a type annotation. And if we do, we should consider finding a more understandable error message.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions