[Python-ideas] PEP 428 - object-oriented filesystem paths

Steven D'Aprano steve at pearwood.info
Sun Oct 7 03:36:30 CEST 2012


On 07/10/12 09:41, Christian Heimes wrote:

> * Jason Orendorff's path module has some methods that are quite useful
> for shell and find like script. I especially like the
> files(pattern=None), dirs(pattern=None) and their recursive counterparts
> walkfiles() and walkdirs(). They make code like recursively remove all
> pyc files easy to write:
>
>    for pyc in path.walkfiles('*.py'):
>        pyc.remove()

Ouch! My source code!!! *grin*


> * I like to see a convenient method to format sizes in SI units (for
> example 1.2 MB, 5 GB) and non SI units (MiB, GiB, aka human readable,
> multiple of 2). I've some code that would be useful for the task.

So do I.

http://pypi.python.org/pypi/byteformat

Although it's only listed as an "alpha" package, that's just me being
conservative about allowing changes to the API. The code is actually
fairly mature.

If there is interest in having this in the standard library, I am more
than happy to target 3.4 and commit to maintaining it.



-- 
Steven



More information about the Python-ideas mailing list