* multiplication with caution in python fast initialization list

* python multiplication sign is often used in fast initialization list, but there is a hidden danger:

The object is copied multiplication sign point to the same space. When an object is copied as immutable, no problem, but Dangdang is copied object is a variable type, if there is a change in reference to this storage space, other reference list of the storage space may also change.

By id () may verify their spatial points

So create a more secure way to use the initialization list for the way:

 

 

reference:

https://blog.csdn.net/tongda530/article/details/88089495

 

Guess you like

Origin www.cnblogs.com/sbj123456789/p/11270145.html