[issue11107] Cache constant "slice" instances

2020-11-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: Batuhan Taskaya opened a duplicate issue #42454. Since it includes PR-23496, with some review, and at least as much discussion, I am closing this issue, contrary to normal policy. Worthwhile? Batuhan found about 10 constant slices in 3200 PyPI packages,

[issue11107] Cache constant "slice" instances

2019-05-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Remi: The reason they're not hashable is presumably because it would make them valid dictionary keys, further confusing the difference between sequences and mappings. x[::-1] would, for a sequence, return a reversed sequence, but for a mapping, would end up

[issue11107] Cache constant "slice" instances

2019-05-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: To support slice constants we need to change the marshal format and introduce new version (current version is 4 and it was stable for several releases). If my memory do not betray me we already discussed this on other issue and the conclusion was that the

[issue11107] Cache constant "slice" instances

2019-05-07 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi josh.r, this may be dump but is there a reason not to make slices hashable? Couldn't they hash like a tuple (start, stop, step)? I looked around in the code, bpo and the mailing lists but could not find a reason why not, maybe it was just not useful at the t

[issue11107] Cache constant "slice" instances

2019-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm trying to sprint on this this week. I already had a PoC put together, but it has some significant issues caused by one major quirk with slices: 1. They're immutable, but 2. They're not hashable In various places, it is (reasonably) assumed that constants

[issue11107] Cache constant "slice" instances

2018-12-03 Thread Josh Rosenberg
Change by Josh Rosenberg : -- versions: +Python 3.8 -Python 3.5 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue11107] Cache constant "slice" instances

2014-03-06 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +ShadowRanger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue11107] Cache constant "slice" instances

2014-01-31 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue11107] Cache constant "slice" instances

2014-01-31 Thread Yury Selivanov
Changes by Yury Selivanov : -- versions: +Python 3.5 -Python 3.3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11107] Cache constant "slice" instances

2011-11-27 Thread Meador Inge
Changes by Meador Inge : -- nosy: +meador.inge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11107] Cache constant "slice" instances

2011-11-18 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Hmm, ok, but AFAICT, your patch was rejected rather because of the way > it approached the problem, not so much because of the issue itself. I would be rather for the patch myself. The bytecode currently generated for sliced indexing is awfully suboptimal. >

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, ok, but AFAICT, your patch was rejected rather because of the way it approached the problem, not so much because of the issue itself. Plus, the fact that Python 3 requires slices in more places than Python 2 (which had the lower level getslice protocol) m

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Similar idea has been rejected in issue2268 because the win was too small to justify the number of changes that had to be made. -- nosy: +belopolsky ___ Python tracker

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Stefan Behnel
Stefan Behnel added the comment: Erm, issue 10227. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue11107] Cache constant "slice" instances

2011-02-03 Thread Stefan Behnel
New submission from Stefan Behnel : Follow-up to ticket 10227. The following facts seem to indicate that it would be worth caching constant instances of the slice type, such as in [:] or [:-1]. with cached slice instance: $ ./python -m timeit -s 'l = list(range(100)); s=slice(None)' 'l[s]' 100