space added before printed line from except block

Terry Reedy tjreedy at udel.edu
Tue Dec 24 17:05:32 EST 2002


> On a different note, I'm wondering why str.join expects a 'list' as
an argument:
>while os.path.join requires separate arguments... Seems rather
>inconsistent? Anyone?

Hypotheses ;-)

1. str.join(alist) was previously string.join(alist, joiner) so one
alist instead of separate args was necessary (joiner comes after alist
since it has default value and alist does not).  2. Its the inverse of
str.split  3. alist is commonly formed by construction in a loop with
alist.append. 4. the items joined are commonly 'homogeneous' in some
sense.

1. os.path.join()  can be inverse of os.path.split. which produces
tuple that is commonly assigned to separate vars.  2. joined path
components are logically hierarchical rather that parallel.  3.
sequencial construction of a 'joinlist' would be rare.

Overall, I suspect the two different interfaces each make most sense
in the different contexts of usage.

Terry J. Reedy





More information about the Python-list mailing list