In writing a script, I ended up with a function signature like the following
def do_multiprocess_action(some_argument: str, communication_pipe: typing.Optional[multiprocessing.connection.Connection]) -> subprocess.Popen:
In an attempt to comply with PEP8, I split the definition up like the below
def do_multiprocess_action(some_argument: str,
communication_pipe: typing.Optional[multiprocessing.connection.Connection]
) -> subprocess.Popen:
but with the type anotation, the line is far too long. What's the idiomatic way to deal with this?
You could define the annotation first, then write your function:
MultiprocessingConnection = typing.Optional[
multiprocessing.connection.Connection]
def do_multiprocess_action(some_argument: str,
communication_pipe: MultiprocessingConnection) -> subprocess.Popen:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With