Yes, this is pretty annoying. It was designed like this because you can apply str.join to every iterable object, not only array. The same way as len(iterable) is not specific to array but generic and that's why it's not a method of the array like array.len().
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Array to String joining in Python. The syntax is as follows:
array = ["apple", "banana", "pear"]
separator = ","
separator.join(array)
Why is the action on the separator?! In most other languages, the separator is optional, but here its where you start!
I'm a Ruby guy and my impression of Python at the time was that it more functional.
I would have expected
join(array, separator)
or
array.join(separator)
but not
separator.join(array)
Yes, this is pretty annoying. It was designed like this because you can apply
str.join
to every iterable object, not only array. The same way aslen(iterable)
is not specific to array but generic and that's why it's not a method of the array likearray.len()
.