BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> 
>     1. Make all python files in the a directory executable:
[...]
>         ==>
>         for f in Path('/usr/home/guido/bin'):
>             f.chmod(0755)

Iterating over a path string to read the contents of the directory possibly
pointed to by that string seems like "magic implicit" behaviour.  Perhaps
making it a method explicitly returning an iterator would by more Pythonic?

    for f in Path(...).readDir():

>     4. Splitting a path into directory and filename:
[...]
>         Path("/path/to/foo/bar.txt").splitpath()

Good.  But the opposite isn't done similarly:

>     6. Create directory paths:
[...]
>         Path("foo") / "bar" / "baz"

Using "/" as "path concatenation operator" seems like un-Pythonic magic as
well (while "+" would be an improvement, it's still not a large one).  I would
think 

    Path('foo').appendparts('bar', 'baz')

or similar would be more readable and obvious.

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                           <[EMAIL PROTECTED]>
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to