On 2019-07-18 20:52, Ben Bacarisse wrote:
Danilo Coccia writes:
Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
[snip]
Of course str.split('') could be defined to work the way you expect, but
it's possible that the error is there to prompt the programmer to be
more explicit.
It is even more
Danilo Coccia writes:
> Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
>> Irv Kalb writes:
>>
>>> I have always thought that split and join are opposite functions. For
>>> example, you can use a comma as a delimiter:
>>>
>> myList = ['a', 'b', 'c', 'd', 'e']
>> myString = ','.join(myLi
Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
> Irv Kalb writes:
>
>> I have always thought that split and join are opposite functions. For
>> example, you can use a comma as a delimiter:
>>
> myList = ['a', 'b', 'c', 'd', 'e']
> myString = ','.join(myList)
> print(myString)
>> a,b,
On 7/18/19 6:27 AM, Ben Bacarisse wrote:
> One reason might be that str.split('') is not unambiguous. For example,
> there's a case to be made that there is a '' delimiter at the start and
> the end of the string as well as between letters. '' is a very special
> delimiter because every string th
Irv Kalb writes:
> I have always thought that split and join are opposite functions. For
> example, you can use a comma as a delimiter:
>
myList = ['a', 'b', 'c', 'd', 'e']
myString = ','.join(myList)
print(myString)
> a,b,c,d,e
>
myList = myString.split(',')
print(myLis
On 2019-07-18 00:24, Tim Daneliuk wrote:
On 7/17/19 4:24 PM, Chris Angelico wrote:
Agreed. There are a number of other languages where splitting on an
empty delimiter simply fractures the string into characters (I checked
Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful
feature.
On 7/17/19 4:24 PM, Chris Angelico wrote:
> Agreed. There are a number of other languages where splitting on an
> empty delimiter simply fractures the string into characters (I checked
> Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful
> feature. +1.
Not only that, it makes the la
On Thu, Jul 18, 2019 at 7:06 AM Irv Kalb wrote:
> If I join the list with the empty string as the delimiter:
>
> >>> myList = ['a', 'b', 'c', 'd']
> >>> myString = ''.join(myList)
> >>> print(myString)
> abcd
>
> That works great. But attempting to split using the empty string generates
> an err
I have always thought that split and join are opposite functions. For example,
you can use a comma as a delimiter:
>>> myList = ['a', 'b', 'c', 'd', 'e']
>>> myString = ','.join(myList)
>>> print(myString)
a,b,c,d,e
>>> myList = myString.split(',')
>>> print(myList)
['a', 'b', 'c', 'd', 'e']
W