X Tutup
The Wayback Machine - https://web.archive.org/web/20251004111226/https://github.com/python/cpython/pull/114363
Skip to content

Conversation

Rowlando13
Copy link

@Rowlando13 Rowlando13 commented Jan 21, 2024

Remove redundant mentions. If you scroll down half a page you have almost the same sentence.
Reword TypeAlias intro. The root issue is that TypeAlias and type soft keyword are not the same. It is clear enough in the TypeAlias section, but you have to know to look there. I think is fair to hint at it in the introduction. If this is not direct enough, you could replace
Or marked with TypeAlias to make it explicit that this is a type alias, not a normal variable assignment

Or marked with TypeAlias to make it explicit that this is a type alias, not a normal variable assignment
Note this is separate and distinct from the keyword type. For more see, TypeAlias


📚 Documentation preview 📚: https://cpython-previews--114363.org.readthedocs.build/

@ghost
Copy link

ghost commented Jan 21, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link

@ajoino ajoino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Comment on lines 171 to 172
.. deprecated:: 3.12
For reasoning see :data:`TypeAlias`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to PEP 695 (maybe things have changed since then) TypeAlias is deprecated but not scheduled for removal. I believe this overlaps with the concept of soft deprecation introduced around the same time. I think it would make sense to write that TypeAlias is soft deprecated, but I'm not sure if there is an rst directive for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft deprecation is probably a good fit here, yes.

Comment on lines 164 to 165
Additionally and also for backward compatibility types can be marked with
:data:`TypeAlias`. ::
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the notion of backwards compatibility could be specified further, as this discussion shows that the behaviour of the TypeAliasType is not entirely intuitive. We should specify that TypeAlias should be used when you want a type alias that behaves like a normal type at run-time. This may be evident to typing experts, but many are surprised by this behaviour.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we should mention the tradeoff here.

specification of the typing system, see :pep:`484`. For a simplified
introduction to type hints, see :pep:`483`.

This module provides runtime support for type hints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this paragraph was changed; that seems unrelated to the purpose of the PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed because this section is repetitive. Almost the same text is 1 page scroll down on the same page.

Comment on lines 171 to 172
.. deprecated:: 3.12
For reasoning see :data:`TypeAlias`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft deprecation is probably a good fit here, yes.

Comment on lines 164 to 165
Additionally and also for backward compatibility types can be marked with
:data:`TypeAlias`. ::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we should mention the tradeoff here.


Or marked with :data:`TypeAlias` to make it explicit that this is a type alias,
not a normal variable assignment::
The following example is an expansion of the above that shows what is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with this sentence and I don't think it clarifies the situation for new users.

@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants
X Tutup