A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20131125/b067d92e/attachment.html below:

<p dir="ltr"><br>
On 25 Nov 2013 09:42, "Ben Hoyt" <<a href="mailto:benhoyt@gmail.com">benhoyt@gmail.com</a>> wrote:<br>
><br>
> > Using "**" for directory spanning globs is also another case of us borrowing<br>
> > a reasonably common idiom from *nix systems that may not be familiar to<br>
> > Windows users.<br>
><br>
> Okay, *nix wins then. :-) Python's stdlib is already fairly<br>
> *nix-oriented (even when it's being cross-platform), so I guess it's<br>
> not a big deal.<br>
><br>
> My only remaining concern then is that there shouldn't be more than<br>
> one way to do recursive globbing in a new API like this. Why does<br>
> rglob() exist when the documentation simply says "like calling glob()<br>
> but with '**' added in front of the pattern"?<br>
><br>
> <a href="http://docs.python.org/dev/library/pathlib.html#pathlib.Path.rglob">http://docs.python.org/dev/library/pathlib.html#pathlib.Path.rglob</a></p>
<p dir="ltr">Because it's a layered API - embedding ** in the pattern is a strictly more powerful interface, but can be a little tricky to get your head around (especially if you don't use a shell that has the feature). rglob() is simpler, but not as flexible.</p>

<p dir="ltr">We offer that kind of multi-level API fairly often. For example, subprocess.call() and friends are simpler interfaces for particular ways of using the powerful-but-complex subprocess.Popen API. The metaprogramming stack (functions, classes, decorators, descriptors, metaclasses) similarly offers the ability to trade increased complexity for increases in power and flexibility.</p>

<p dir="ltr">In these cases, the "obvious way" is to use the simplest API that covers the use case, and only reach for the more complex API when you genuinely need it.</p>


<p dir="ltr">Cheers,<br>
Nick.</p>
<p dir="ltr">><br>
> -Ben<br>
</p>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4