On 4/20/2020 11:18 AM, Christopher Barker wrote:
On Mon, Apr 20, 2020 at 10:07 AM gyro funch <gyromagne...@gmail.com <mailto:gyromagne...@gmail.com>> wrote:

    On 4/20/2020 9:25 AM, J. Pic wrote:
    The following is not currently possible, but is consistent with other
    functions such as 'sorted':

    something = mylist.appended(Something())


no, it's not -- sorted() is a function, not a method. and there is a reason it's not list.sorted() (more than one actually)

It turns out the OP wan't asking for exactly what I thought, but the point still stands: mutating methods return None. That is a consistent interface standard in Python.

But your suggestion of an .appended()  method does tie in to the "fluid interface" conversation on this list a while back -- if you are interested in the idea, I suggest you search the archives.

-CHB


Yes, I know the difference between a function and method and understand the motivation for the function 'sorted' versus a method. The idea was that there was a strong enough need in the past to include another 'tense' of sort that returned a transformed list from the input iterable. I presume that list.appended could do an analogous thing.

I do, however, appreciate the pointer to the 'fluid interface' conversation.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@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/EKZ6GCIUUMH7KETPWA643QSQYDEHD5US/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to