[Python-Dev] Adding the 'path' module (was Re: Some RFE for review)
Trent Mick
trentm at ActiveState.com
Mon Jun 27 20:28:05 CEST 2005
> >os.getcwd() returns a string, but path.getcwd() returns a new path
> >object.
>
> In that case, I'd expect it to be 'path.fromcwd()' or 'path.cwd()'; i.e. a
> constructor classmethod by analogy with 'dict.fromkeys()' or
> 'datetime.now()'. 'getcwd()' looks like it's getting a property of a path
> instance, and doesn't match stdlib conventions for constructors.
>
> So, +1 as long as it's called cwd() or something better (i.e. clearer
> and/or more consistent with stdlib constructor conventions).
What about have it just be the default empty constructor?
assert path.Path() == os.getcwd() \
or path.Path() == os.getcwdu()
Dunno if that causes other weirdnesses with the API, though.
Trent
--
Trent Mick
TrentM at ActiveState.com
More information about the Python-Dev
mailing list