Thanks for the video. Now it is clear to me what has happened and why copy
solves the problem.
--
https://mail.python.org/mailman/listinfo/python-list
params = {} if params is None else params.copy()
has solved the problem.
I have provided just a toy example here. Execute method actually takes
dict[str, List]. List contains objects. Each object has two properties, so I
have a logic that analyzes these properties and returns None or List as a
On 2020-06-14 19:44:32 +0200, Peter J. Holzer wrote:
> [1] There is a very good talk by Raymond Hettinger on how variables and
> objects in Python work. Unfortunately I can't find it at the moment.
Sorry, that talk was by Ned Batchelder (that's why I couldn't find it):
https://www.youtube.com
On 2020-06-14 08:20:46 -0700, zljubi...@gmail.com wrote:
> consider this example:
>
> from typing import Dict, List
>
>
> class chk_params:
> def execute(self, params: Dict[str, List] = None):
> if params is None:
> params = {}
>
> for k, v in params.items():
>
zljubi...@gmail.com wrote:
> Hi,
>
> consider this example:
>
> from typing import Dict, List
>
>
> class chk_params:
> def execute(self, params: Dict[str, List] = None):
> if params is None:
> params = {}
>
> for k, v in params.items():
> params[k]
zljubi...@gmail.com wrote at 2020-6-14 08:20 -0700:
>Hi,
>
>consider this example:
>
>from typing import Dict, List
>
>
>class chk_params:
>def execute(self, params: Dict[str, List] = None):
>if params is None:
>params = {}
>
>for k, v in params.items():
>
zljubi...@gmail.com writes:
> Hi,
>
> consider this example:
>
> from typing import Dict, List
>
>
> class chk_params:
> def execute(self, params: Dict[str, List] = None):
> if params is None:
> params = {}
>
> for k, v in params.items():
> params[k] = [
Hi,
consider this example:
from typing import Dict, List
class chk_params:
def execute(self, params: Dict[str, List] = None):
if params is None:
params = {}
for k, v in params.items():
params[k] = [val + 10 for val in v]
return params.values