-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
The documentation states that:
A lamba function which has a single objective of passing all it is arguments to another callable can be safely replaced by that callable.
But this is not always true. For instance:
get_now_isoformat = lambda: datetime.now().isoformat()This will be autofixed this way:
get_now_isoformat = datetime.now().isoformatBut the two functions do not have the same behaviour:
>>> # A different result is returned everytime the function is called
>>> get_now_isoformat_v1() == get_now_isoformat_v1()
False
>>> # The result is "frozen"
>>> get_now_isoformat_v2() == get_now_isoformat_v2()
Truecorenting
Metadata
Metadata
Assignees
Labels
No labels