PEP on path module for standard library

Peter Hansen peter at engcorp.com
Fri Jul 22 17:53:22 EDT 2005


Michael Hoffman wrote:
> Peter Hansen wrote:
> 
>> When files are opened through a "path" object -- e.g. 
>> path('name').open() -- then file.name returns the path object that was 
>> used to open it.
> 
> Also works if you use file(path('name')) or open(path('name')).

Since that's exactly what the path module does, it's not surprising. 
Practically everything that path does, with a few useful exceptions, is 
a thin wrapper around the existing calls.  path.open, for example is 
merely this:

   def open(self, mode='r'):
       return file(self, mode)

-Peter



More information about the Python-list mailing list