May-06-2020, 04:26 AM
Hi,
I was wondering if there was a preferred style for type hinting. In particular inline:
or on a seperate line via
There is obviously pros and cons; e.g. 1st form is shorter, but 2nd reads more like traditional Python and is less cluttered making it easier to see the arguments.
Also I'm using PyCharm and its PEP8 warning wants an added space, i.e. PyCharm wants:
Should PEP8 be modified to allow no blank line for overloads? PEP8 considerable pre-dates type hints! The no-blank for overloads style is what
Thanks in advance for any advice,
Howard.
I was wondering if there was a preferred style for type hinting. In particular inline:
1 |
def process( self , items: Iterator[T], items2: Iterator[T]) - > Iterator[T]: |
@overload
:1 2 3 |
@overload def process( self , items: Iterator[T], items2: Iterator[T]) - > Iterator[T]: ... def process( self , items, items2): |
Also I'm using PyCharm and its PEP8 warning wants an added space, i.e. PyCharm wants:
1 2 3 4 |
@overload def process( self , items: Iterator[T], items2: Iterator[T]) - > Iterator[T]: ... def process( self , items, items2): |
typeshed
uses. Also typeshed
uses the inline style unless the function actually requires @overload
to type it correctly.Thanks in advance for any advice,
Howard.