[issue40160] documentation example of os.walk should be less destructive
Kyle Stanley
report at bugs.python.org
Sat May 23 22:26:37 EDT 2020
Kyle Stanley <aeros167 at gmail.com> added the comment:
> I made the suggested change to just print the os.remove() statements (instead of executing them) and also removed the 'skip news'.
I think you may have misunderstood the suggestion.
Specifically, the key part was "I would suggest adding succinct comments or a note that very briefly explains how one could see a visual demonstration...". This would mean the actual code in the example would be *unchanged*, but with a new code comment or separate note after the example that explains how one could replace ``os.remove(os.path.join(root, name))`` with ``print(f"os.remove({os.path.join(root, name)})")`` for a purely visual demonstration that doesn't affect any local files.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40160>
_______________________________________
More information about the Python-bugs-list
mailing list