Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

spec: Definition of materialization is insufficient

Aberta
#2,027 2 comentários 4 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
38/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
python
Domínio
documentation

Direção de pesquisa

Comece pela definição de materialization na typing specification vinculada e analise o exemplo de list[int] | list[str] em comparação com list[Any]. Avalie a regra proposta de que unions de materializations permanecem materializations, incluindo seu efeito sobre assignability e equivalence; o trabalho estará concluído quando houver uma mudança acordada na specification e um texto explicativo atualizado.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

topic: typing spec

The spec currently defines materialization as follows:

Given a gradual type A, if we replace zero or more occurrences of Any in A with some type (which can be different for each occurrence of Any), the resulting gradual type B is a materialization of A.

A type A is assignable to B if there exists a pair of materializations A' and B' of A and B such that A' is a subtype of B'.

Now let's consider whether list[int] | list[str] is assignable to list[Any]. To do so, we have to consider materializations of list[Any], created by substituting Any with some other type. But there's nothing we can substitute for Any that would make for a fully static type that is a supertype of list[int] | list[str], since list is invariant in its type parameter. Therefore, list[int] | list[str] is not assignable to list[Any]. Relatedly, this means list[Any] | list[Any] is not equivalent to list[Any]. This is obviously not a desirable conclusion; current type checkers treat list[int] | list[str] as assignable to list[Any], and they should.

I think to fix this, we could say that if A' and A'' are materializations of A, then the union A' | A'' must also be a materialization of A.

Linguagem predominante
Python
Estrelas
1.8k
Forks
302
Merge médio
4h 16min
PRs com merge (30d)
7

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python/typing

Todas as issues de python/typing

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.