String.join revisited (URGENT for 1.6)
Juergen A. Erhard
jae at ilk.de
Fri Jun 2 21:00:29 EDT 2000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> "Martijn" == Martijn Faassen <m.faassen at vet.uu.nl> writes:
Martijn> Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:
>> Indeed - there seem to be just as many subjective arguments
>> in favour of any of the alternatives, so the safest thing
>> to do is leave the darn thing alone!
>> I know we're promised that string.join will still be there,
>> but if ''.join exists, people will start using it, and it
>> won't be long before it's unremovable. Too Many Ways To Do It...
Martijn> Agreed. So keeping string.join() would seem to be the
Martijn> best alternative, definitely (or possibly making this a
Martijn> builtin, so you don't have to import to use it, making it
Martijn> import-equivalent with the new .split()).
Martijn> a = "foo bar baz"
Martijn> b = a.split(" ")
Martijn> assert a == sjoin(b, " ")
Martijn> versus:
Martijn> a = "foo bar baz"
Martijn> b = a.split(" ")
Martijn> assert a == " ".join(b)
Martijn> Perhaps we should've left 'split' alone too. :)
I'm in favor of giving the mythical Sequence type (which I *hope* will
be created when the types/classes split will be healed (yes, healed))
a `join' method.
It would seem (at least to me) to be the nicest (and cleanest) design
to be able to do:
"some string".split().join()
Bye, J
PS: I don't like `sjoin', by the way... looks much too ugly for such a
beautiful language as Python.
- --
Jürgen A. Erhard eMail: jae at ilk.de phone: (GERMANY) 0721 27326
MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html
GNU Privacy Guard (http://www.d.shuttle.de/isil/crypt/gnupg.html)
pros do it for money -- amateurs out of love.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: Use Mailcrypt and GnuPG <http://www.gnupg.org/>
iEYEARECAAYFAjk4WKsACgkQN0B+CS56qs2xCwCggqYM/LxYramyyOX9YLDoAWVZ
seAAoIXl6eIVdxM8/+h5YTS9c0ug3Yo8
=QcMC
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list