question about adding a feature - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: question about adding a feature (/thread-34453.html) |
question about adding a feature - Skaperen - Aug-02-2021 i am adding a reverse=False|True feature to my file tree recurse generator. my question is this: when reverse is true, should directory names be yielded before descending into that directory or after (when ascending back up)? RE: question about adding a feature - Gribouillis - Aug-02-2021 You could have another option with values "prefix"|"infix"|"postfix" RE: question about adding a feature - Skaperen - Aug-03-2021 (Aug-02-2021, 04:41 AM)Gribouillis Wrote: You could have another option with values "prefix"|"infix"|"postfix" with what semantics? i was thinking: descend=True|False and ascend=False|True where they indicate a directory name is or is not yielded at that particular event for every directory descended into (not for those matching exclude= when i implement that). when i specify reverse=True and descend=True and ascend=False the order of the tree looks funny. specifying descend=False and ascend=True gives me an order suitable for removing the whole tree (i am unsure if reverse=True is needed) even while it is being recursed. RE: question about adding a feature - Gribouillis - Aug-03-2021 Oh I think I misunderstood the original question. If you have 'descend' and 'ascend' options, I don't think the value of 'reverse' should implicitly alter these values. It would be confusing. RE: question about adding a feature - Skaperen - Aug-05-2021 ok. if i do explain this in the docs i'll just say that to get a full tree reverse one must use the per-directory reverse and use ascend items for directories instead of descend. |