Re: Access (ordered) dict by index; insert slice
Is there ANY chance of setting the default reply-to to the list? I know everyone else thinks that's a bid idea, but I doubt this was actually intended just for me. If it was, I apologize for bringing it back on the list. On Sun, Jul 12, 2020 at 10:12 PM Inada Naoki <songofacandy@gmail.com> wrote:
On Mon, Jul 13, 2020 at 1:51 PM Christopher Barker <pythonchb@gmail.com> wrote: As I and Eric already said several times, we can do it in C already -- itertools.islice.
...
itertools.islice is implemented in C too. No need to call next() from
Python stack.
Ahh -- thanks! I had no idea islice() was in C -- yes, then, there probably is little to gain from a C implementation. I'd still be interested in the performance comparison, but not enough to try to write a direct-access-to-the-internals-of-dict C version myself :-) I still like the idea of indexing the order-preserving dict, but we do seem to not have any compelling use cases. Particularly if someone does get a reservoir sampling implementation in the stdlib. (see another thread for that) -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
On Mon, Jul 13, 2020, 3:04 PM Christopher Barker <pythonchb@gmail.com> wrote:
Is there ANY chance of setting the default reply-to to the list? I know everyone else thinks that's a bid idea, but I doubt this was actually intended just for me.
If it was, I apologize for bringing it back on the list.
On Sun, Jul 12, 2020 at 10:12 PM Inada Naoki <songofacandy@gmail.com> wrote:
On Mon, Jul 13, 2020 at 1:51 PM Christopher Barker <pythonchb@gmail.com> wrote: As I and Eric already said several times, we can do it in C already -- itertools.islice.
...
itertools.islice is implemented in C too. No need to call next() from
Python stack.
Ahh -- thanks! I had no idea islice() was in C -- yes, then, there probably is little to gain from a C implementation.
I'd still be interested in the performance comparison, but not enough to try to write a direct-access-to-the-internals-of-dict C version myself :-)
I still like the idea of indexing the order-preserving dict, but we do seem to not have any compelling use cases.
Some ideas for optimizing lookup of ordered indexed structures: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html :
loc, .iloc, and also [] indexing can accept a callable as indexer. See more at Selection By Callable.
Methods like pyarrow.Table.from_pandas() have a preserve_index option which defines how to preserve (store) or not to preserve (to not store) the data in the index member of the corresponding pandas object. This data is
Pandas > Enhancing performance > Numba > Vectorize https://pandas.pydata.org/pandas-docs/stable/user_guide/enhancingperf.html#v... ( https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction... ) https://docs.rapids.ai/api/cudf/stable/guide-to-udfs.html#Numba-Kernels-on-C... https://arrow.apache.org/docs/python/pandas.html#handling-pandas-indexes tracked using schema-level metadata in the internal arrow::Schema object. ... Type signatures are particularly helpful for indexes.
Particularly if someone does get a reservoir sampling implementation in the stdlib. (see another thread for that)
-CHB
-- Christopher Barker, PhD
Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZL2VYG... Code of Conduct: http://python.org/psf/codeofconduct/
participants (2)
-
Christopher Barker
-
Wes Turner