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.