#4974: [with patch, needs review] eliminate normalize_slice in favor of a
standard
Python idiom
--------------------+-------------------------------------------------------
Reporter: jason | Owner: craigcitro
Type: defect | Status: assigned
Priority: major | Milestone: sage-3.3
Component: misc | Resolution:
Keywords: |
--------------------+-------------------------------------------------------
Changes (by craigcitro):
* summary: [with patch, needs work] make
sage.libs.pari.gen._normalize_slice a
miscellaneous function for dealing with slices
=> [with patch, needs review] eliminate
normalize_slice in favor of a standard Python
idiom
Comment:
What Jason says above is exactly right -- there's no point trying to outdo
Python, because it already is quite fast, and does all this for us. Plus,
we can't miss corner cases this way.
Ultimately, things could get faster with nice Cython support for slices.
This isn't wildly pressing, but it should be easy to implement.
Apply only the newest `trac-4974.patch`. This patch simply removes
`normalize_slice`.
We should make a note about using this for slices somewhere -- apparently,
`range(*s.indices(size))` is a standard Python idiom (it's in '''Python in
a Nutshell'''), so we should use it more.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4974#comment:17>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---