integer copy

Thomas Jollans tjol at tjol.eu
Fri Oct 20 05:09:53 EDT 2017


On 2017-10-20 10:58, ast wrote:
> 
> "ast" <nomail at com.invalid> a écrit dans le message de
> news:59e9b419$0$3602$426a74cc at news.free.fr...
> 
> Neither works for large integers which is
> even more disturbing
> 
> a = 6555443
> b = copy.copy(a)
> a is b
> 
> True


Why is this disturbing? As you said, it'd be completely pointless.

As to what's going on: copy.copy does not make any attempt to copy
immutable types. That's all there is to it.

Read the source if you want to know how this is done.
https://github.com/python/cpython/blob/master/Lib/copy.py#L111



-- 
Thomas Jollans



More information about the Python-list mailing list