"ast" <nomail@com.invalid> writes: > "ast" <nomail@com.invalid> 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 (type(None), int, long, float, bool, str, tuple, | frozenset, type, xrange, types.ClassType, | types.BuiltinFunctionType, type(Ellipsis), | types.FunctionType, weakref.ref): | d[t] = _copy_immutable | [...] and d[t] is what decides how to copy, via _copy_dispatch. So none of the types listed above will be actually copied. It should be documented more precisely. You should file a documentation-improvement request. Also, the doc says: | This version does not copy types like module, class, function, method, | nor stack trace, stack frame, nor file, socket, window, nor array, nor | any similar types. But who knows what "similar types" are... -- Alain. -- https://mail.python.org/mailman/listinfo/python-list