New submission from Christoph Zwerschke <[email protected]>:
Just noticed the following code in urrlib.parse_qsl:
pairs = [s1 for s1 in qs.split(separator)]
for name_value in pairs:
...
see
https://github.com/python/cpython/blob/088a15c49d99ecb4c3bef93f8f40dd513c6cae3b/Lib/urllib/parse.py#L755
This looks like an unnecessary list comprehension to me, probably a relic of
earlier code that used a nested list comprehension for splitting with two
different separators.
Can't we just do this instead now, which is faster and shorter?
for name_value qs.split(separator):
I can provide a PR if wanted.
----------
components: Library (Lib)
messages: 392345
nosy: cito
priority: normal
severity: normal
status: open
title: Simplify urllib.parse_qsl
type: performance
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python
3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com