Serhiy Storchaka added the comment:

I agree that it would be nice to have. But this feature has a cost.

$ ./python -m timeit -s 'from urllib.parse import ParseResult' -- 
"ParseResult('http', 'u...@example.com:p...@www.python.org:080', '/doc/', '', 
'query=yes', 'frag')"
Unpatched: 1.61 usec per loop
Patched:   2.1 usec per loop

$ ./python -m timeit -s 'from urllib.parse import urlparse' -- 
'urlparse("http://u...@example.com:p...@www.python.org:080/doc/?query=yes#frag";)'

Unpatched: 8.87 usec per loop
Patched:   9.22 usec per loop

Is this cost significant?

The cost can be decreased by using global _tuple_new = tuple.__new__. But this 
couples the code too tight to implementation details of namedtuple.

----------
nosy: +rhettinger, serhiy.storchaka

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

Reply via email to