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)?
You could have another option with values "prefix"|"infix"|"postfix"
(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.
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.
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.