[Python-ideas] Vectorization [was Re: Add list.join() please]
David Mertz
mertz at gnosis.cx
Mon Feb 4 07:10:59 EST 2019
On Mon, Feb 4, 2019, 12:47 AM Christopher Barker
> I've lost track if who is advocating what, but:
>
Well, I made a toy implementation of a Vector class. I'm not sure what that
means I advocate other than the existence of a module on GitHub.
FWIW, I called the repo 'stringpy' as a start, so that expressed some
interest in it being about vectors of strings. But so-far, I haven't found
anything that actually needs to be string-like. In general, methods get
passed through to their underlying objects and deliberately duck typed,
like:
v.replace("a", "b")
>>
>
As an extra, we could enforce homogeneity, or even string-nesss
specifically. I don't really know what homogeneity means though, once we
consider ABCs, subclasses, and duck types that don't use inheritance on r
ABC registration. At least so far, I haven't coded anything that would get
a performance gain from enforcing the string-nesss of items (but all pure
Python so far, no Cython or C)
This is adding something - maybe just compactness, but I also think
> readability.
>
I think with changed methods the win gets greater:
v.replace("a", "b").upper().apply(myfun)
If you want to do any generic items, it becomes a lot harder.
>
So far, generic has been a lot easier to code than hand-rolled methods.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190204/d6e8d04c/attachment-0001.html>
More information about the Python-ideas
mailing list