Define functions with too many arguments to abide by PEP8 standard

前端 未结 7 638
日久生厌
日久生厌 2021-02-01 00:12

I have defined a function with a long list of arguments. The total characters in definition is above 80 and doesn\'t abide by PEP8.

def my_function(argument_one,         


        
7条回答
  •  孤城傲影
    2021-02-01 01:03

    I personally like to line up the params one-per-line starting with the open parentheses and keeping that indent. flake8 seems happy with it too.

    def guess_device_type(device_name: str,
                          username: str=app.config['KEY_TACACS_USER'],
                          password: str=app.config['KEY_TACACS_PASS'],
                          command: str='show version') -> str:
        """Get a device_type string for netmiko"""
    

提交回复
热议问题