Author aeros
Recipients aeros
Date 2019-07-01.06:30:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561962630.68.0.390698602335.issue37462@roundup.psfhosted.org>
In-reply-to
Content
As a quality of life enhancement, it would beneficial to set a default starting directory for os.walk() to use when one is not specified. I would suggest for this to be the system's current working directory. 

The implementation would be rather straightforward, and should not cause any compatibility issues. In the function definition for walk in os.py, it would simply need to be changed from "def walk(top, topdown=True, onerror=None, followlinks=False)" to "def walk(top=".", topdown=True, onerror=None, followlinks=False)".

As a separate topic but relevant to os.walk(), the current name of the positional argument which specifies the starting directory is currently called "top". However, a more descriptive word for the argument would probably be "root", "dir", "directory", or "start". The term "top" is quite generic and is not used to describe a filesystem position. 

Personally, I'm the most in favor of "root" as it describes the highest parent node of a tree, and provides an accurate description of its purpose.  However, I will hold off on adding a PR for this change until some feedback is added, as it is not essential to the initial issue.

Changing the name of argument could cause potential compatibility issues if the name is specified when using os.walk(), such as in "os.walk(top="dirpath")". However, doing so would be significantly unconventional. In the majority of common use cases, os.walk() only uses the first argument, so there is no need to specify the keyword. Even when more than one is used, usually the first argument is specified by position rather than keyword.
History
Date User Action Args
2019-07-01 06:30:30aerossetrecipients: + aeros
2019-07-01 06:30:30aerossetmessageid: <1561962630.68.0.390698602335.issue37462@roundup.psfhosted.org>
2019-07-01 06:30:30aeroslinkissue37462 messages
2019-07-01 06:30:30aeroscreate