R. David Murray added the comment:

Python's philosophy is one of duck typing, which means that in general we just 
let the functions fail with whatever error they produce when the in put 
datatype is wrong.  The error message in this case is fairly straightforward: 
you passed a list and it says that that data type doesn't work.  The linux case 
is a bit more problematic in that it *doesn't* produce an error for invalid 
input.  The problem there is that we can't raise an error if there's only one 
argument for backward compatibility reasons: there almost certainly exists code 
that depends on single argument path returning the argument.  

In theory there shouldn't be code that depends on that single argument being an 
incorrect data type, but it would still only be something we'd consider 
changing in a feature release.

I'm not sure it is worth fixing, frankly, but I've attached a patch we could 
consider applying to 3.5.  (aside: the isinstance check in _get_sep looks like 
a bug report waiting to happen...it will do the wrong thing if passed a 
bytearray or memoryview...)

There may be others who will advocate for a stricter type check or a try/except 
with a "better" error message...I'd be OK with the better error message as long 
as it doesn't break the duck typing rule.

----------
keywords: +patch
nosy: +r.david.murray
Added file: http://bugs.python.org/file38701/join_datatype_check.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23780>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to