
[Python]自分用メモ - sort()とsorted()の違い
1. 結論 - それぞれの関数の違い
違いその1 : 戻り値
sort() -> "None"が返ってくる
sorted() -> 並び替えられた状態の新しいListが返ってくる
違いその2 : 扱えるオブジェクトの種類
sort() -> Listのみ
sorted() -> Listを含むiterableオブジェクト

補足 : iterableオブジェクトとは?
iterable
An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects, and objects of any classes you define with an __iter__() method or with a __getitem__() method that implements sequence semantics.
自分なりに訳してみた。
iterable
要素を1つずつ取り出し、呼び出し元に渡すことができるオブジェクトのこと。例としては、要素の並び順を管理するList、str、tupleをはじめ、要素の並び順を管理しないdict、file objects、_ _iter_ _()、または_ _getitem_ _()によって順序管理を実装されたクラスのことが挙げられます。

2. 検証

*Paizaで提供されているWeb上の開発環境で検証を実施しました