Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report this problem to Python's developers #59

Open
artgoldberg opened this issue Oct 26, 2020 · 0 comments
Open

Report this problem to Python's developers #59

artgoldberg opened this issue Oct 26, 2020 · 0 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@artgoldberg
Copy link
Contributor

As of Python 3.7, Python's parsing of PEP 526 type annotations does not report replicated attributes properly. A replicated attribute name with default value(s) is not consistent in namespace and namespace['__annotations__']. namespace['__annotations__'] contains the attribute's last type BUT its order there reflects its FIRST declaration. And namespace contains the attribute's LAST default value. This example illustrates the problem, with EventMessage defined below.

class ExampleEventMessageWithReplicatedAttr(EventMessage):
    name: str = 'hi'
    unit_price: float
    quantity_on_hand: int = 0
    name: float = 1.1
    name: int
@artgoldberg artgoldberg added the help wanted Extra attention is needed label Oct 26, 2020
@artgoldberg artgoldberg self-assigned this Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant