On 2019-02-20 10:10, Steven D'Aprano wrote: > Or if you're worried about the line length: > result = function(mystr.strip() > .expandtabs() > .lower() > .replace('ham', 'spam') > I think
It seems that this fluency discussion, and the vector discussion is similar; I made a toy class [1] to demonstrate. It is much like DavidMertz's vector [2], but focused on chained methods . The `vector()` method lets us enter "vector mode". There are methods that act on elements (eg. map), methods that act on the whole (eg. sort), and methods that exit vector mode (eg. list). output = vector([3, 2, 1]).append(4).sort().limit(10).list() Fluency can be had by entering vector mode on a singleton list: output = ( vector([mystr]) .strip() .expandtabs() .lower() .replace("ham", "spam") .map(function) .first() ) Given vector() is quite succinct, and Numpy and Pandas do vector operations elegantly already, I do not think there is need for vectorized operators or fluency operators in Python. [1] My toy class - https://github.com/klahnakoski/mo-vector/blob/master/mo_vector/__init__.py [2] DavidMertz vector 0- https://github.com/DavidMertz/stringpy/blob/master/vector.py _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/