Skip to content

using [] and {} as default param value #2

@zhaowb

Description

@zhaowb

It's generally not encouraged to use [] and {} as function param default value because they are prone to cause unexpected modifications if the default value is used and modified in the function. The best way is to declare param=None then in the start of the function check if param is None then let param = [] (or {})

In cfn_lambda_handler/cfn_lambda_handler.py there are 3 places of such case,

  1. CfnLambdaExecutionTimeout.__init__
  2. cfn_handler
  3. Handler.__init__

Currently the code doesn't modify these params so there is no bug but I feel it's better to change these cases to prevent bugs if future changes modify these params.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions