Re: integer copy

2017-10-20 Thread Thomas Jollans
On 2017-10-20 13:17, bartc wrote: > On 20/10/2017 10:09, Thomas Jollans wrote: > >> Read the source if you want to know how this is done. >> https://github.com/python/cpython/blob/master/Lib/copy.py#L111 > > Good, informative comment block at the top of the type that you don't > see often. Usuall

Re: integer copy

2017-10-20 Thread bartc
On 20/10/2017 10:09, Thomas Jollans wrote: Read the source if you want to know how this is done. https://github.com/python/cpython/blob/master/Lib/copy.py#L111 Good, informative comment block at the top of the type that you don't see often. Usually they concern themselves with licensing or wi

Re: integer copy

2017-10-20 Thread Thomas Jollans
On 2017-10-20 10:58, ast wrote: > > "ast" a écrit dans le message de > news:59e9b419$0$3602$426a7...@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 complete

Re: integer copy

2017-10-20 Thread Stephen Tucker
ast, For what it's worth, After a = 5 b = 5 afloat = float(a) bfloat = float(b) afloat is bfloat returns False. Stephen Tucker. On Fri, Oct 20, 2017 at 9:58 AM, ast wrote: > > "ast" a écrit dans le message de > news:59e9b419$0$3602$426a7...@news.free.fr... > > Neither works for large int

Re: integer copy

2017-10-20 Thread ast
"Thomas Nyberg" a écrit dans le message de news:mailman.378.1508491267.12137.python-l...@python.org... On 10/20/2017 10:30 AM, ast wrote: I am aware that it is useless to copy an integer (or any immutable type). ... any comments ? Why is this a problem for you? Cheers, Thomas It is no

Re: integer copy

2017-10-20 Thread Thomas Nyberg
On 10/20/2017 10:30 AM, ast wrote: > I am aware that it is useless to copy an integer > (or any immutable type). > > ... > > any comments ? > > Why is this a problem for you? Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: integer copy

2017-10-20 Thread Alain Ketterlin
"ast" writes: > "ast" a écrit dans le message de > news:59e9b419$0$3602$426a7...@news.free.fr... > > Neither works for large integers which is > even more disturbing > > a = 6555443 > b = copy.copy(a) > a is b > > True In copy.py: | [...] | def _copy_immutable(x): | return x | for t in (t

Re: integer copy

2017-10-20 Thread ast
"ast" a écrit dans le message de news:59e9b419$0$3602$426a7...@news.free.fr... Neither works for large integers which is even more disturbing a = 6555443 b = copy.copy(a) a is b True -- https://mail.python.org/mailman/listinfo/python-list

integer copy

2017-10-20 Thread ast
Hello, I tried the following: import copy a = 5 b = copy.copy(a) a is b True I was expecting False I am aware that it is useless to copy an integer (or any immutable type). I know that for small integers, there is always a single integer object in memory, and that for larger one's there ma