Skip to content

Working on howto/annotations.po - #1242

Open
dyp1109 wants to merge 1 commit into
python:3.14from
dyp1109:howto/annotations
Open

dyp1109 wants to merge 1 commit into
python:3.14from
dyp1109:howto/annotations

Conversation

@dyp1109

@dyp1109 dyp1109 commented Sep 13, 2026

Copy link
Copy Markdown

Resolve #1241

Comment thread howto/annotations.po
"在某些 Python 版本中,類別實例可能會帶有 ``__annotations__`` 的屬性,但這並非"
"受支援的功能。如果你需要取得實例的註釋,可以用 :func:`type` 來存取實例的類別"
"(例如在 Python 3.14+ 中使用 "
"``annotationlib.get_annotations(type(myinstance))`` )."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"``annotationlib.get_annotations(type(myinstance))`` )."
"``annotationlib.get_annotations(type(myinstance))``)。"

Comment thread howto/annotations.po
Comment on lines +388 to +390
"你應該避免直接存取物件的 ``__annotations__`` 。請改"
"用 :func:`annotationlib.get_annotations` (Python 3.14+) "
"或 :func:`inspect.get_annotations` (Python 3.10+)."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"你應該避免直接存取物件的 ``__annotations__`` 。請改"
"用 :func:`annotationlib.get_annotations` (Python 3.14+) "
"或 :func:`inspect.get_annotations` (Python 3.10+)."
"你應該避免直接存取物件的 ``__annotations__``。請改"
"用 :func:`annotationlib.get_annotations` (Python 3.14+) "
"或 :func:`inspect.get_annotations` (Python 3.10+)。"

Comment thread howto/annotations.po
Comment on lines +496 to +501
"如果你使用的類別具有自訂的元類別,並存取該類別的 ``__annotations__`` ,你可能"
"會觀察到出乎意料的行為;請查閱 :pep:`749 <749#pep749-metaclasses>` 的例子。你"
"可以在Python 3.14+ 使用 :func:`annotationlib.get_annotations` 或者在 Python "
"3.10+ 使用 :func:`inspect.get_annotations` 來避免這些問題。在更早期的版本,你"
"可以存取類別的 :attr:`~type.__dict__` 來避免這些問題。(例如:"
"``cls.__dict__.get(‘__annotations__’, None)`` )"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"如果你使用的類別具有自訂的元類別,並存取該類別的 ``__annotations__`` ,你可能"
"會觀察到出乎意料的行為;請查閱 :pep:`749 <749#pep749-metaclasses>` 的例子。你"
"可以在Python 3.14+ 使用 :func:`annotationlib.get_annotations` 或者在 Python "
"3.10+ 使用 :func:`inspect.get_annotations` 來避免這些問題。在更早期的版本,你"
"可以存取類別的 :attr:`~type.__dict__` 來避免這些問題。(例如:"
"``cls.__dict__.get(‘__annotations__’, None)`` )"
"如果你使用的類別具有自訂的元類別且會存取該類別的 ``__annotations__`` ,你可能"
"會觀察到不預期的行為;請查閱 :pep:`749 <749#pep749-metaclasses>` 的例子。你"
"可以在 Python 3.14+ 使用 :func:`annotationlib.get_annotations` 或者在 Python "
"3.10+ 使用 :func:`inspect.get_annotations` 來避免這些問題。在更早期的版本,你"
"可以存取類別的 :attr:`~type.__dict__` 來避免這些問題(例如:"
"``cls.__dict__.get('__annotations__', None)``)。"

This branch has not been deployed

No deployments
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.

Translate howto/annotations.po

2 participants