Pythonについて(アンチ専用)
■ このスレッドは過去ログ倉庫に格納されています
0502デフォルトの名無しさん
2009/06/10(水) 01:13:40一つの理由を見つけただけですべてを判った気になるな。
ちゃんとそのFAQの最後に、
Because this is a string method it can work for Unicode strings as
well as plain ASCII strings. If join() were a method of the sequence
types then the sequence types would have to decide which type of
string to return depending on the type of the separator.
って書いてあるだろーが。
>>477,495 が正解であると同時に、「strのjoinだからstr.join」というのも
正解だ。
Rubyは自分で文字列と同じ振る舞いをする型を追加したら、
join_to_mystr なんてメソッドを Enumerable に追加するのか?
似たものを追加するときに同じ方法を一貫して使えるのが
正しい方法だ。
■ このスレッドは過去ログ倉庫に格納されています