Skip to content

[Enhancement] Add List.join(sep="") method. - #260

Open
khchen wants to merge 1 commit into
ThakeeNathees:masterfrom
khchen:list_join
Open

[Enhancement] Add List.join(sep="") method.#260
khchen wants to merge 1 commit into
ThakeeNathees:masterfrom
khchen:list_join

Conversation

@khchen

@khchen khchen commented Jun 23, 2022

Copy link
Copy Markdown

Also add separator as an optional argument to builtin list_join().

[1, 2, 3].join(',') looks better than list_join([1, 2, 3], ',').
However, list_join() is used in string interpolation, and builtin function is faster than method call.
So keep builtin list_join() but add a new method to List class.

Example:

print([1, 2, 3].join())
print([1, 2, 3].join(', '))

Output:

123
1, 2, 3

Also add separator as an optional argument to builtin list_join().
@khchen khchen changed the title Add List.join(sep="") method. [Enhancement] Add List.join(sep="") method. Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant