Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify docs of os.walk() #61618

Closed
gsingh mannequin opened this issue Mar 14, 2013 · 4 comments
Closed

Clarify docs of os.walk() #61618

gsingh mannequin opened this issue Mar 14, 2013 · 4 comments
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@gsingh
Copy link
Mannequin

gsingh mannequin commented Mar 14, 2013

BPO 17416
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2013-03-15.22:05:25.988>
created_at = <Date 2013-03-14.09:43:01.272>
labels = ['type-feature', 'docs']
title = 'Clarify docs of os.walk()'
updated_at = <Date 2013-03-17.23:51:31.372>
user = 'https://bugs.python.org/gsingh'

bugs.python.org fields:

activity = <Date 2013-03-17.23:51:31.372>
actor = 'terry.reedy'
assignee = 'docs@python'
closed = True
closed_date = <Date 2013-03-15.22:05:25.988>
closer = 'terry.reedy'
components = ['Documentation']
creation = <Date 2013-03-14.09:43:01.272>
creator = 'gsingh'
dependencies = []
files = []
hgrepos = []
issue_num = 17416
keywords = []
message_count = 4.0
messages = ['184153', '184266', '184324', '184408']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'docs@python', 'gsingh']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue17416'
versions = ['Python 3.3']

@gsingh
Copy link
Mannequin Author

gsingh mannequin commented Mar 14, 2013

Source page: http://docs.python.org/3/library/os.html
Entry: os.walk(...)

Ambiguity Source: Name of the argument TopDown and / or its description.

The TopDown name is misleading to me. I would suggest BFS or DFS instead. TopDown false would imply to me that the traversal would run bottom up "from" the directory mentioned in the argument list (even though the name of that argument is top, it is confusing indicating a possibility of another naming mistake instead!)

@gsingh gsingh mannequin assigned docspython Mar 14, 2013
@gsingh gsingh mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Mar 14, 2013
@terryjreedy
Copy link
Member

The unambiguous title of your first report was better, so I copied it with a new method name.

Changing a parameter name will break code, so it is essentially never done. In any case, directory trees are considered to grow 'down' from the root directory, and tree walkers recurse 'down' to leaves, even though biological trees usually grow 'up'. You just have to get used to the standard inverted metaphor.

I read the doc entry and I do not see any need to change, so I am closing this.

@terryjreedy terryjreedy changed the title Documentation Ambiguity 2 Clarify docs of os.walk() Mar 15, 2013
@gsingh
Copy link
Mannequin Author

gsingh mannequin commented Mar 16, 2013

Hi Terry,

I understand it is ok for you. I agree that you are not in favour of changing the argument name. And you are correct that I must get familiar to the convention that has been used. Further since you say, perhaps, I now feel that it may be used in other languages documentation as well.

But I still seriously 'request' you again to add the word BFS (Breadth First Search) to the "only the documentation" of TopDown = True and "DFS like" for the case of False. If a kid (like me) who reads an algorithms textbook and not familiar with the conventions being followed - 'may' make a mistake and waste time debugging.

@terryjreedy
Copy link
Member

I considered your point, re-read the walk entry, and still wish to leave it as it is. First, we are not in the business of providing synonyms for everything. Second, The abbreviations BFS and DFS did not immediately register with me, even though I am quite familiar with the concepts. I expect that many would find them more confusing rather than less. So they would need to be spelled out. There is also the issue of whether the defined topdown behavior is 'exactly' what any particular person would consider 'breadth-first search'. For one thing, walk does not exactly visit leaf-nodes -- it provides a list of them so that the caller can 'visit' them.

Unselecting 'Resolution' amounts to partially reopening an issue. Please don't do that.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant