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.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to