Naming is quite hard, I admit. Although, when encounter such situation, we can
always look back into stdlibs or how our BDFL did it.
On the top of my head, there are a couple of sets of names related to this
issue: "range" and "xrange", "items" and "iteritems", "map" and "imap".
It seems that in "x{something}" and "iter{something}", "something" is usually a
noun, while "i{something}" contains verbs.
Despite of the fact that "i{something}" is named in such way because it's in
itertools module, naming other functions in this way would cause confusion.
It's still worthwhile to refer to the convention of existing code base when
dealing with "style" issues.
Sent from my iPhone
- Ryutlis
On Aug 10, 2013, at 6: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.
>
>
--
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.