Class-qualified annotation expressions
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation
Research direction
Start with the type and annotation expressions specification, especially the definition of name and qualified name, and compare it with the A.B example in the issue. Review how existing type checkers interpret class-qualified annotations; done means the specification clearly states whether class members are included and how the example is covered.
Written by the indexing model from the issue text.
Description
The wonderfully useful specification of type annotation expressions describes what kinds of expressions are valid type annotations.
I believe the spec does not include a case which type checkers support, although as we will see this comes down to semantics :)
class A:
class B:
pass
x: A.B = A.B()
The A.B annotation seems to fall under the name rule:
| name
(where name must refer to a valid in-scope class,
type alias, or TypeVar)
The spec helpfully continues:
Any leaf denoted as name may also be a qualified name (i.e., module '.' name or package '.' module '.' name, with any level of nesting).
The concept of a "qualified name" occurs only in this section, and the parenthetical explanation serves as it's most precise definition, as far as I can tell.
Should we extend the definition of "qualified name" to also include class members? Or maybe I should read the class as a "module" or a "package" and the existing definition suffices?
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/typing
-
topic: typing spec
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
topic: typing spec
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
topic: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
topic: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
topic: conformance tests topic: typing spec
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·