[issue33214] join method for list and tuple

2019-09-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is history, but in 1997 Python had the same order of arguments as ECMAScript: string.join(words [, sep]). str.join() was added only in 1999 (226ae6ca122f814dabdc40178c7b9656caf729c2). -- ___ Python tracker

[issue33214] join method for list and tuple

2019-09-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: How common is the case of variable number of things to concatenate/union/merge? >From my experience, in most ceases this looks like: result = [] for ...: # many complex statements # may include continue and break

[issue33214] join method for list and tuple

2019-09-16 Thread Christian Heimes
Christian Heimes added the comment: > in javascript join() is made the other way around > ['1','2','3'].join(', ') > so, [].join() may confuse some peoples. It would be too confusing to have two different approaches to join strings in Python. Besides ECMAScript 1 came out in 1997, 5 years

[issue33214] join method for list and tuple

2019-09-16 Thread Александр Семенов
Александр Семенов added the comment: in javascript join() is made the other way around ['1','2','3'].join(', ') so, [].join() may confuse some peoples. -- nosy: +iamsav ___ Python tracker

[issue33214] join method for list and tuple

2019-09-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note that all of Serhiy's examples are for a known, fixed number of things to concatenate/union/merge. str.join's API can be used for that by wrapping the arguments in an anonymous tuple/list, but it's more naturally for a variable number of things, and the

[issue33214] join method for list and tuple

2018-04-06 Thread Éric Araujo
Change by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list

[issue33214] join method for list and tuple

2018-04-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: String concatenation: f'{a}{b}{c}' List concatenation: [*a, *b, *c] Tuple concatenation: (*a, *b, *c) Set union: {*a, *b, *c} Dict merging: {**a, **b, **c} -- nosy: +serhiy.storchaka

[issue33214] join method for list and tuple

2018-04-03 Thread Javier Dehesa
Javier Dehesa added the comment: Thanks Christian. I thought of join precisely because it performs conceptually the same function as with str, so the parallel between ''.join(), [].join() and ().join() looked more obvious. Also there is os.path.join and PurePath.joinpath,

[issue33214] join method for list and tuple

2018-04-03 Thread Christian Heimes
Christian Heimes added the comment: join() is a bad choice, because new developers will confusing list.join with str.join. We could turn list.extend(iterable) into list.extend(*iterable). Or you could just use extend with a chain iterator: >>> l = [] >>>

[issue33214] join method for list and tuple

2018-04-03 Thread Javier Dehesa
New submission from Javier Dehesa : It is pretty trivial to concatenate a sequence of strings: ''.join([str1, str2, ...]) Concatenating a sequence of lists is for some reason significantly more convoluted. Some current options include: sum([lst1, lst2, ...], [])