[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

Serhiy Storchaka report at bugs.python.org
Sun Apr 9 03:28:29 EDT 2017


Serhiy Storchaka added the comment:

namedtuple's attribute access was optimized in recent years. In 3.7 it is 30% faster than in 3.4. So now it is only 3x times slower compared to a plain tuple. On other hand, os.walk() and os.fwalk() was optimized too. In 3.7 they are up to 3.5x times faster than in 3.4 (with hot caches). I didn't make measurements, but I expect that using namedtuples with os.walk() can decrease its performance at least by few percents.

My main concern is that this feature will increase the complexity of the documentation of the os module (very little) and may encourage writing less clear code (but this is just my own preference, others can found new style more clear).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26860>
_______________________________________


More information about the Python-bugs-list mailing list