Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

khchen
Copy link

@khchen khchen commented Jun 23, 2022

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