[issue18857] urlencode of a None value uses the string 'None'
R. David Murray
report at bugs.python.org
Fri Feb 7 20:56:55 CET 2014
R. David Murray added the comment:
No, the domain of URIs does not have *any* concept of a null value. It only has the concept of a string being empty or not empty (or the key not existing at all...ie: it doesn't exist in your params dict).
You are trying to map a Python concept (the singleton object None, which is used for a variety of purposes) into a domain that does not have an equivalent concept.
That said, following the requests model of omitting the key if the value is None is something we could consider as a convenience enhancement. But we would again run into Python's strict backward compatibility policy. I could imagine some programmer building an internal web service that turns the string 'None' back into a Python None value. The fact that it would have to be an internal thing would mean we'd never hear about it...until we broke it :)
Whether or not adding this feature would require a new keyword argument to urlencode is a judgment call. It might be an acceptable change in a feature release.
----------
versions: +Python 3.5 -Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18857>
_______________________________________
More information about the Python-bugs-list
mailing list