I go back and forth on functions a lot when the input variables mimic python builtins. For example, the word bytes
is a python builtin, but consider a utility library that parses bytes:
def parse_bytes(bytes):
pass
I'd argue this has great readability, but pep8 linters don't like it. Instead I could do
def parse_bytes(bytearray):
pass
def parse_bytes(somebytes):
pass
Or use type hinting
def parse_bytes(b: bytes):
pass
But all of these seem worse. Same thing happens if your variable name is input
...
At the end of the day I usually go with somebytes