Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / Python

Base de conhecimento — Python

Sintaxe, operadores e conceitos de programação. Encontra uma explicação, consulta um exemplo e continua a aprender.

Entradas: 583

Python

dict.popitem

Remove e devolve o último par inserido que ainda existe, por ordem LIFO.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

dict.setdefault

Devolve o valor existente ou insere o predefinido apenas se a chave faltar.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

dict.update

Insere no dicionário existente associações de um mapeamento, um iterável de pares ou argumentos nomeados.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

dict.values

Devolve uma vista dinâmica dos valores por ordem de inserção das chaves.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

function.__doc__

Este atributo contém a documentação da função ou None se não existir docstring.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

function.__name__

Este atributo contém o nome simples da função dado na sua definição.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.cache

Memoriza resultados sem limite como lru_cache(maxsize=None).

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.cached_property

O primeiro acesso calcula o valor e guarda-o com o mesmo nome no `__dict__` modificável da instância.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.cmp_to_key

Adapta um comparador de dois argumentos a uma chave de ordenação unária.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.lru_cache

Guarda resultados por chaves com hash e ao encher remove a entrada usada há mais tempo.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.partial

Devolve um objeto que se pode chamar com argumentos predefinidos sem executar func.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.partialmethod

Define na classe um descritor de variante de método com argumentos predefinidos.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.reduce

Reduz da esquerda chamando a função com o acumulador e o elemento seguinte.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.singledispatch

Escolhe a implementação pelo tipo do primeiro argumento posicional.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.singledispatchmethod

Escolhe o método pelo primeiro argumento posicional após self ou cls.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.total_ordering

Completa comparações de ordem em falta a partir por exemplo de `__lt__` e de igualdade `__eq__` coerente.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.update_wrapper

Altera os metadados do invólucro e devolve a mesma função.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

functools.wraps

Aplica-se à função invólucro interna ao escrever um decorador.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

generator.send

send fornece o resultado da expressão yield suspensa e devolve o próximo valor produzido.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

heapq.heapify

Constrói em tempo linear um heap de mínimos a partir de uma lista.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

heapq.heappop

Retira e devolve o menor elemento de um heap de mínimos válido.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

heapq.heappush

Acrescenta um elemento a uma lista vazia ou a um heap de mínimos válido e devolve None.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

heapq.heappushpop

Combina a inserção e a extração do mínimo mantendo o tamanho do heap.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

heapq.heapreplace

Retira a raiz anterior e conserva o novo elemento num heap do mesmo tamanho.

Intermédio · Python 3.14; repository image, production runtime not attested