Aviv Palivoda added the comment:

In regard to Raymond`s points I agree with Serhiy`s comments.

As for Serhiy`s doubts:

> 3. Using namedtuple is slower and consumes more memory than using tuple. Even 
> for FS-related operation like os.walk() this can matter. A lot of code is 
> optimized for exact tuples, with namedtuple this optimization is lost.

I did some testing on my own PC:
./python -m timeit -s "from os import walk"  "for x in walk('Lib'): pass"

Regular tuple: 7.53 msec
Named tuple: 7.66 msec

> 4. New names (dirpath, dirnames, filenames) are questionable. Why not use 
> undersores (dir_names)? "dir" in dirpath refers to the current proceeded 
> directory, but "dir" in dirnames refers to it's subdirectories. Currently you 
> are free to use short names (root, dirs, files) from examples or what you 
> prefer, but with namedtuple you are sticked with standard names forever. 
> There are no names that satisfy everybody.

I agree that there will be no names that will satisfy everybody but I think the 
names that are currently in the documentation are the most trivial choice.

As for points 1,2,5 this feature doesn`t break any of the old walk API.

One more point I would like input on is the testing. I can remove the walk 
method from the WalkTests, FwalkTests classes and use the new named tuple 
attributes in the tests. Do you think its better or should we keep the tests 
with the old API (access using indexes)?

----------

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

Reply via email to