[Python-Dev] Adding the 'path' module (was Re: Some RFE for review)

Michael Hoffman hoffman at ebi.ac.uk
Sun Jun 26 21:19:29 CEST 2005


On Sun, 26 Jun 2005, Phillip J. Eby wrote:

> * drop getcwd(); it makes no sense on a path instance

Personally I use path.getcwd() as a class method all the time. It
makes as much sense as fromkeys() does on a dict instance, which is
technically possible but non-sensical.

> And, assuming these file-content methods are kept:
>
> * path.bytes()         -> path.get_file_bytes()
> * path.write_bytes()   -> path.set_file_bytes() and path.append_file_bytes()
> * path.text()          -> path.get_file_text()
> * path.write_text()    -> path.set_file_text() and path.append_file_text()
> * path.lines()         -> path.get_file_lines()
> * path.write_lines()   -> path.set_file_lines() and path.append_file_lines()

I don't know how often these are used. I don't use them myself. I am
mainly interested in this module so that I don't have to use os.path
anymore.

Reinhold Birkenfeld wrote:

> One more issue is open: the one of naming. As "path" is already the
> name of a module, what would the new object be called to avoid
> confusion? pathobj?  objpath? Path?

I would argue for Path. It fits with the recent cases of:

from sets import Set
from decimal import Decimal
-- 
Michael Hoffman <hoffman at ebi.ac.uk>
European Bioinformatics Institute



More information about the Python-Dev mailing list