Skip to content

Use lowercase set, frozenset and deque where possible - #6346

Merged
hauntsaninja merged 1 commit into
python:masterfrom
AlexWaygood:set-and-frozenset
Nov 19, 2021
Merged

hauntsaninja merged 1 commit into
python:masterfrom
AlexWaygood:set-and-frozenset

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

This PR solely consists of changing typing.Set to set, typing.FrozenSet to frozenset, and typing.Deque to deque. It should hopefully have no mypy_primer diff at all.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@hauntsaninja
hauntsaninja merged commit 5c8e68f into python:master Nov 19, 2021
@AlexWaygood
AlexWaygood deleted the set-and-frozenset branch November 19, 2021 23:10
JukkaL added a commit to JukkaL/typeshed that referenced this pull request Dec 13, 2021
`collections.abc.Set` was accidentally replaced with `set` in python#6346.
The prior is an alias to `typing.AbstractSet`, instead of
`builtins.set`.

Since `collections.abc.Set` is easily confused with `typing.Set`, it
seems clearer to use `typing.AbstractSet` here.
@risicle

risicle commented Jun 25, 2026

Copy link
Copy Markdown

I'm trying to understand the rationale behind doing this for the return types in typing.ItemsView and typing.KeysView, forcing them to return concrete sets instead of merely Set implementations.

@srittau

srittau commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

typing.Set is just an alias for set, both concrete classes. Maybe you are thinking of the (confusingly named) collections.abc.Set?

@risicle

risicle commented Jun 25, 2026

Copy link
Copy Markdown

I am indeed referring to AbstractSet, which would seem to make more sense here.

@JelleZijlstra

Copy link
Copy Markdown
Member

If you have a proposed change to make, better to make an issue (or PR) instead of posting on a change from five years ago; lots has changed in typeshed since then.

@risicle

risicle commented Jun 25, 2026

Copy link
Copy Markdown

I guess I thought it was more likely I had misunderstood something 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants