Files
cursopython2023/aula145.py

17 lines
597 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Positional-Only Parameters (/) e Keyword-Only Arguments (*)
# *args (ilimitado de argumentos posicionais)
# **kwargs (ilimitado de argumentos nomeados)
# 🟢 Positional-only Parameters (/) - Tudo antes da barra deve
# ser ❗APENAS❗ posicional.
# PEP 570 Python Positional-Only Parameters
# https://peps.python.org/pep-0570/
# 🟢 Keyword-Only Arguments (*) - * sozinho ❗NÃO SUGA❗ valores.
# PEP 3102 Keyword-Only Arguments
# https://peps.python.org/pep-3102/
def soma(a, b, /, *, c, **kwargs):
print(kwargs)
print(a + b + c)
soma(1, 2, c=3, nome='teste')