william.ayd <william....@icloud.com> added the comment:

Hmm well I still personally feel that the implementation is somewhat off mores 
than the documentation. Specifically I think it is confusing that it accepts an 
empty iterable but not one containing elements.

This is fine:

urllib.parse.quote("/", safe=[])

Though this isn't:

urllib.parse.quote("/", safe=['/'])

Even though the following two calls are fine (though with different return 
values as expected):

urllib.parse.quote("/", safe='')
urllib.parse.quote("/", safe='/')

It might go against the spirit of duck typing but I find it very nuanced that 
empty iterables are allowed but if non-empty it must be a string. Would it not 
make more sense to raise if a non-String type is passed?

----------

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

Reply via email to