Python Enhancement Proposals – Style guide, Type hints and Docstring Conventions
Python
Published
November 11, 2024
Python Enhancement Proposals (PEPs)
PEP 8 – Style guide – https://peps.python.org/pep-0008/
PEP 484 – Type Hints – https://peps.python.org/pep-0484/
PEP 257 – Docstring Conventions – https://peps.python.org/pep-0257/
from typing import Uniondef foo(x: Union[int, float]) -> Union[int, float]:""" Squares a numeric input (either int or float) and returns the result. Parameters: x (int or float): The input number to be squared. Returns: int or float: The squared result of the input. """return x **2print(5+5)help(foo)
10
Help on function foo in module __main__:
foo(x: Union[int, float]) -> Union[int, float]
Squares a numeric input (either int or float) and returns the result.
Parameters:
x (int or float): The input number to be squared.
Returns:
int or float: The squared result of the input.