Oh no, the idea here is just you would copy over the floats associated with the PyObject* and keep them in an array of such structs, so that we know which PyObject* are associated with which floats. Then after the standard library quicksort sorts them you would copy the PyObject* into the list. So you sort the PyObject* keyed by the floats. Anyway, I think the copying back and forth would probably be too expensive, it's just an idea. Also, I apologize for the formatting of my last email, I didn't realize Inbox would mess up the quoting like that. I'll ensure I use plain-text quotes from now on.
On Mon, Oct 10, 2016 at 9:38 PM Chris Angelico <ros...@gmail.com> wrote: > On Tue, Oct 11, 2016 at 2:29 PM, Elliot Gorokhovsky > <elliot.gorokhov...@gmail.com> wrote: > > Ya, I think this may be a good approach for floats: if the list is all > > floats, just copy all the floats into a seperate array, use the standard > > library quicksort, and then construct a sorted PyObject* array. Like > maybe > > set up a struct { PyObject* payload, float key } type of deal. > > Not quite sure what you mean here. What is payload, what is key? Are > you implying that the original float objects could be destroyed and > replaced with others of equal value? Python (unlike insurance claims) > guarantees that you get back the exact same object as you started > with. > > ChrisA > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/