Move getmethparlist function from turtle to inspect module
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Feature or enhancement
Proposal:
The getmethpartlist turtle module function does work which seems to be supposed to be done by the inspect module.
In fact, getmethpartlist calls inspect.signature and then iterates over it to produce a call to the callable. Perhaps this second part could also be implemented in the inspect module.
In an issue, @terryjreedy said, “For calls that just want the call signature, I wonder if calling getmethodparlist could be replaced by calling signature.”
So, my suggestion is to add two new methods to Signature class, which:
- Returns the call:
class Signature():
def as_call(self) -> string : ...
- Returns a new Signature without the first parameter if ob is a method:
class Signature():
def as_function(self): ...
Then, getmethpartlist could be:
def getmethpartlist(ob):
defs = inspect.signature(ob).as_function()
call = defs.as_call()
return str(defs), call
Thoughts?
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
https://discuss.python.org/t/move-getmethparlist-function-from-turtle-to-inspect-module/97172
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Revise primeiro getmethpartlist em Lib/turtle.py e a API inspect.Signature existente. Leia a discussão vinculada e o comentário anterior da issue para determinar se a geração de chamadas e o tratamento de parâmetros de métodos pertencem a inspect. A tarefa estará concluída quando houver uma API e um comportamento acordados antes que o escopo da implementação possa ser identificado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- tooling
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Ativa
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 38/100