STINNER Victor <[EMAIL PROTECTED]> added the comment:
Hum, there is not fixer for 2to3. But I might be hard to write such
fixer because walk() generates (dirpath, dirnames, filenames) instead
of (dirpath, filenames).
Python2 prototype:
os.path.walk(path, visit, arg) -> None
with visit: callback(arg, dirpath, filenames)
Python3 prototype:
os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) ->
generator
with onerror: callback()
the generator produces (dirpath, dirnames, filenames)
Example:
os.path.walk('Lib/xml/', callback, 42)
can be replaced by
for dirpath, dirnames, filenames in os.walk('Lib/xml/'):
callback(42, dirpath, dirnames + filenames)
About the keyword only: +1 (or +2 :-)).
Index: Lib/os.py
===================================================================
--- Lib/os.py (révision 67652)
+++ Lib/os.py (copie de travail)
@@ -192,7 +192,7 @@
__all__.extend(["makedirs", "removedirs", "renames"])
-def walk(top, topdown=True, onerror=None, followlinks=False):
+def walk(top, *, topdown=True, onerror=None, followlinks=False):
"""Directory tree generator.
For each directory in the directory tree rooted at top (including
top
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4601>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com