Type hints and a function returning property
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug Report
I have a function that works correctly.
This function uses a string as an argument and return a property.
But when I add type hints that argument is a string and return is a property, mypy says:
main.py:4: error: "property" used with a non-method
main.py:14: error: Incompatible return value type (got overloaded function, expected "property")'
Found 2 errors in 1 file (checked 1 source file)
To Reproduce
A reproducible playground link
Expected Behavior
I expect that the function has to pass mypy test without errors.
Actual Behavior
main.py:4: error: "property" used with a non-method
main.py:14: error: Incompatible return value type (got overloaded function, expected "property")'
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.981
- Mypy command-line flags: no flags
- Mypy configuration options from
mypy.ini(and other config files): default config - Python version used: 3.10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione collegata in mypy playground e gli errori mostrati di main.py, usando mypy 0.981 su Python 3.10 con le impostazioni predefinite. Traccia il modo in cui vengono verificati l’argomento string della funzione e l’annotazione del valore restituito dalla property; il lavoro è completato quando la riproduzione viene eseguita senza gli errori segnalati, preservando il comportamento della funzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100