[Python-3000] Automatically invoking str() in str.join() (original) (raw)
Tim Peters tim.peters at gmail.com
Thu Apr 27 19:46:52 CEST 2006
- Previous message: [Python-3000] Automatically invoking str() in str.join()
- Next message: [Python-3000] Automatically invoking str() in str.join()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Barry Warsaw]
... While I hate the way it looks, I never have gotten mixed up about the order of arguments since switching to ''.join(l).
[Tim Hochberg]
Me too on all counts including the -0.
... But hey, yeah, a join() builtin would be fine if it took the string arg first, so that
''.join(seq) == join('', seq)
Isn't that the same as str.join?
Well, join(a_string, seq), or join(seq, a_string) (depending on who you ask) , would be the same as the current a_string.join(seq). Note that
from string import join
already supplies a functional interface (with the separator second). That's what was used before strings had methods, and it's still there.
In which case why would we need a builtin?
Because people enjoy arguing about the best order for the arguments, and about the best default separator value, neither of which you can argue about in the method spelling ;-)
- Previous message: [Python-3000] Automatically invoking str() in str.join()
- Next message: [Python-3000] Automatically invoking str() in str.join()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]