Deprecate "slice" on built-ins, move it to "types"?
![](https://secure.gravatar.com/avatar/2240a37aad5f5834a92809a5e5f01fe1.jpg?s=120&d=mm&r=g)
This is probably too little to justify the compatibility breakage, but is there a motive for the "slice" type to be on built-ins ? (besides people forgot it there at PEP-3000 time?) It is normally used in super-specialized cases, mostly when one is implementing a Sequence type, and even there just for type-checking, not to create new slice objects. It seems to me it should lie on the "types" module (or some other place), rather than eat built-in namespace (which can confuse newcomers anyway). As I said, the benefits of moving it to a less prominent place may be to little, and incompatibilities would ensue since all modules using it don't expect to have to import it anyway. But maybe thsi should be a thing to keep an eye on for some future Python release? js -><-
![](https://secure.gravatar.com/avatar/5615a372d9866f203a22b2c437527bbb.jpg?s=120&d=mm&r=g)
On Thu, Dec 28, 2017 at 06:09:32PM -0200, Joao S. O. Bueno wrote:
This is probably too little to justify the compatibility breakage,
Indeed. [...]
It seems to me it should lie on the "types" module (or some other place), rather than eat built-in namespace (which can confuse newcomers anyway).
Have you actually come across newcomers who are confused by slice being a built-in? I've been on the tutor mailing list, and comp.lang.python, for many years now and I don't recall anyone even asking about slice let alone being confused by it. -- Steve
![](https://secure.gravatar.com/avatar/97c543aca1ac7bbcfb5279d0300c8330.jpg?s=120&d=mm&r=g)
On Dec 28, 2017 12:10, "Joao S. O. Bueno" <jsbueno@python.org.br> wrote: This is probably too little to justify the compatibility breakage, but is there a motive for the "slice" type to be on built-ins ? (besides people forgot it there at PEP-3000 time?) It is normally used in super-specialized cases, mostly when one is implementing a Sequence type, and even there just for type-checking, not to create new slice objects. It does get called sometimes in numerical code to construct complex indexing operations. -n
participants (3)
-
Joao S. O. Bueno
-
Nathaniel Smith
-
Steven D'Aprano