James Addison <jay+...@jp-hosting.net> added the comment:

Chiming in here to add that I'd appreciate the ability to render 'standalone' 
(i.e. no '=') query-string keys in order to distinguish between 
absence-of-value and empty-string situations.

The backwards-compatibility concerns in here are genuine, so perhaps this could 
be introduced as an argument to urlencode with a disabled default value, 
allowing developers to opt-in.

>> Unless someone can point to a "real" web server that does something 
>> different with "&foo" than with "&foo=", there is no reason to make a change 
>> to Python.

There's a popular nodejs library that makes this serialization distinction 
explicit: https://github.com/sindresorhus/query-string#falsy-values

I've developed a Python 3.7-based set of commits[1] to address this issue.  I 
haven't yet opened this as a pull request since I see that Python 3.7 is in 
maintenance/bugfix mode[2].

In case a new urlencode flag would fall under the category of feature, I'll aim 
to develop a subsequent set of commits against the master development branch 
soon.

[1] - https://github.com/jayaddison/cpython/compare/3.7..9555467

[2] - https://devguide.python.org/#status-of-python-branches

----------
nosy: +jayaddison

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

Reply via email to