Dec-02-2020, 02:37 PM
(Dec-02-2020, 02:16 PM)stranac Wrote: Ah, the good old mutable defaults...Thank you for your answer.
https://python-forum.io/Thread-Basic-Var...on-Gotchas has an explanation of what's going on.
Search for "empty list".
According to you, I searched the internet.
And I used the following solution
class test: def __init__(self,val=None): if val==None:val=[] self.val=valWriting the third line sounds a little silly but I have to.This reduces the readability of Python.
I think for other people with a different id is more useful than the same id.