[Python-ideas] The non-obvious nature of str.join (was Re: sum(...) limitation)
Wolfgang Maier
wolfgang.maier at biologie.uni-freiburg.de
Mon Aug 11 16:12:29 CEST 2014
On 08/11/2014 03:56 PM, Alexander Belopolsky wrote:
>
> On Mon, Aug 11, 2014 at 2:56 AM, Wolfgang Maier
> <wolfgang.maier at biologie.uni-freiburg.de
> <mailto:wolfgang.maier at biologie.uni-freiburg.de>>
> wrote:
>
> I am using Python for teaching programming to absolute beginners at
> university and, in my experience, joiner.join is never a big hurdle.
>
>
> In my experience, it is the asymmetry between x.join(y) and x.split(y)
> which causes most of the confusion. In x.join(y), x is the separator
> and y is the data being joined, but in x.split(y), it is the other way
> around.
>
Once you have explained the beauty of
s == sep.join(s.split(sep))
to anyone, they will not be confused again, but find it perfectly logical.
More information about the Python-ideas
mailing list