I thought of xfind too, but it's not strictly speaking analogous to xrange as it returns an xrange object rather than a generator. I did think that they ended up with a similar naming issue that I have. I don't think ranger would have worked for that case though :)
Yeah finder is growing on me, especially as the package is called pathfinder. Thanks, – John On Sat, Aug 10, 2013 at 2:50 AM, Pádraig Brady <[email protected]> wrote: > On 08/10/2013 02:25 AM, Pádraig Brady wrote: >> On 08/09/2013 11:37 PM, John Keyes wrote: >>> Hi all, >>> >>> I've a small utility that aims to make it easier to search for files >>> based on a name, extension, type, size, dimensions, etc. [1][2] >>> >>> The main function is simply named `find` and it returns a list of file >>> paths. I've now added generator support and I'm wondering how to >>> expose the functionality. >>> >>> Right now I have added a named parameter to the find method. So >>> find(".", fnmatch="*.png") would return a list of paths to png files, >>> and find(".", fnmatch="*.png", generator=True) would return a >>> generator. My nose is twitching at the smell of this. >>> >>> >>> Any ideas folks? Naming things is hard. >>> >>> – John >>> >>> [1] https://github.com/jkeyes/pathfinder >>> [2] https://pathfinder.readthedocs.org/en/latest/ >> >> Maybe find() should return a generator by default. >> That can be trivially converted to a list() if required. > > This would break compat though for certain uses, > which is an issue if you're not the only user. > Consider for example: > > l=find(...) > l.sort() > > You could use xfind() as stblib did for xrange etc :) > I hate that they did that. > Can't think of anything better than finder() TBH. > > cheers, > Pádraig. -- You received this message because you are subscribed to the Google Groups "Python Ireland" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
