Another stupidly simply question, but I have to ask anyway: why do some functions expect their arguments to be what I assume to be lists (square brackets)?
So for instance the bytes function expects the arguments to be written between brackets.
This doesn't seem very helpful in this respect:
So for instance the bytes function expects the arguments to be written between brackets.
bytes([48])Another example would be the run function of the subprocess module:
subprocess.run(['ls', '-l'])And how can one infer this by reading only its definition, and not the examples?
This doesn't seem very helpful in this respect:
Quote: subprocess.run(args, *, stdin=None, input=None, stdout=None, stderr=None, capture_output=False, shell=False, cwd=None, timeout=None, check=False, encoding=None, errors=None, text=None, env=None, universal_newlines=None, **other_popen_kwargs)https://docs.python.org/3/library/subpro...rocess.run
Run the command described by args. Wait for command to complete, then return a CompletedProcess instance.