Hi John.

I'd suggest taking a step back and considering the second line of The Zen
of Python:

    "Explicit is better than implicit."

I'd suggest the word "find" is way too generic here, especially when you
are working with a very specific thing: file paths.  So - keeping The Zen
in mind - I'd go with something like:

    list_paths() and generate_paths()

although I did like the suggestion of always returning a generator which is
then passed to the list() BIF if required.  But, my basic advice is pick a
name which makes it explicit what the function is doing.

My 2 cent.  Hope this helps.

Paul.


On 9 August 2013 23:37, John Keyes <[email protected]> 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/
>
> --
> 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.
>
>
>


-- 
Paul Barry, w: http://paulbarry.itcarlow.ie - e: [email protected]
Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland.

-- 
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.


Reply via email to