python / python/mypy

Documentation needs a glossary

Aperta
#12,888 1 commento 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

documentation feature
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Feature

I've realized lately that I lack a clear set of terms to discuss many typing concepts with my team, and I think the community as a whole suffers from this as well.

examples:

  1. how do we describe a generic class with a type var instead of a concrete type? e.g. Foo[T]. abstract generic? unparameterized generic? just plain "generic"?
  2. how do we describe a generic class with a concrete type? e.g. Foo[int] concrete generic? parameterized generic?
  3. what is the verb used to describe the act of converting a generic between these two states? parameterizing?
  4. how do we describe a generic class with more than one TypeVar?
  5. I think it's clear that TypeVar('T', bound=...) can be described as a "bound type var", but how do we describe a TypeVar of the form TypeVar('T', int, float)?

We should be able to combine terms to form a clear taxonomy, for example:

T = TypeVar("T", bound=A)

class Foo(Generic[T]):
     pass

FooB = Foo[B]

Foo is a "bound unparameterized user generic".
FooB is a "parameterized user type alias".

etc.

Pitch

I've looked around in the mypy documentation for clues to these questions and not found anything very definitive. In the absence of an authoritative source on this subject, members of the community stumble over these concepts in team meetings, github issues, and in the names and documentation of our python functions.

Thanks for reading!

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando la documentazione di mypy per individuare la terminologia esistente relativa a generics e TypeVars, quindi confrontala con gli esempi nell’issue. Il lavoro sarà completo quando un glossario autorevole definirà termini coerenti per i casi di generic e TypeVar elencati e potrà essere utilizzato in tutta la documentazione del progetto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.