splitting using '\' as a delimiter

Johann Hibschman johannh at uclink.berkeley.edu
Mon Dec 3 01:23:20 EST 2001


"Peoter Veliki" <peoter_veliki at hotmail.com> writes:

> So the string.split and the re.split swap the order of the arguments??!!
> What was the logic behind this decision?

I think it was just that, for string.split, the string that you're
splitting is the primary object, so it comes first.
i.e. string.split(x, y) = x.split(y).  Meanwhile, for re.split, the
primary object is the re, so re.split(y, x) = y.split(x).

Well, to be correct, re.split(y, x) = re.compile(y).split(x).

-J



More information about the Python-list mailing list