A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/060028.html below:

[Python-Dev] The path module PEP

[Python-Dev] The path module PEP [Python-Dev] The path module PEPCharles Cazabon python at discworld.dyndns.org
Tue Jan 24 21:56:51 CET 2006
BJörn Lindqvist <bjourne at gmail.com> 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                           <python at discworld.dyndns.org>
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------
More information about the Python-Dev mailing list

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