Deepcopying slice objects

Gabriel Genellina gagsl-py2 at
Tue Dec 16 10:43:25 CET 2008

En Sun, 14 Dec 2008 15:43:01 -0200, Max Argus <argus.max at>

> I stumbled across a thread about that suggests fixing deepcopy to let it
> copy slice objects. (
> I
> expected this to work and don't see any reason why it shouldn't in case
> there is a good reason why it dosen't work can someone please explain it.

It works fine, both in 2.6 and 3.0:

py> from copy import copy, deepcopy
py> x = slice(1, 10, 2)
py> copy(x)
slice(1, 10, 2)
py> deepcopy(x)
slice(1, 10, 2)

Gabriel Genellina

More information about the Python-list mailing list