filesystem_spec icon indicating copy to clipboard operation
filesystem_spec copied to clipboard

Correctly handle maxdepth kwarg

Open ianthomas23 opened this issue 2 years ago • 4 comments

As identified in discussion of PR #1128, maxdepth kwarg that is used in walk and related functions can be improved in two ways:

  • Raise as an error if maxdepth < 0.
  • maxdepth=0 should be handled differently to maxdepth=1.

ianthomas23 avatar Dec 13 '22 09:12 ianthomas23

Is maxdepth=0 useful for anything?

martindurant avatar Dec 13 '22 14:12 martindurant

It is supported in command line find where it does the somewhat counterintuitive find only within the supplied filename arguments. I've never had a real world use case for this. So one could argue that we should keep it for consistency with command line find, or we could simply disallow it because it is mostly useless?

ianthomas23 avatar Dec 13 '22 15:12 ianthomas23

Let's get rid of it!

martindurant avatar Dec 13 '22 15:12 martindurant

Happily!

ianthomas23 avatar Dec 13 '22 16:12 ianthomas23