=?UTF-8?B?QnJhbmtvIMSMaWJlag==?= <brane@xbc.nu> writes:
> Daniel Rall wrote:
>
> >blair@tigris.org writes:
> >
> >Minor detail regarding os.path in the Subversion Python code; path is
> >a variable of the os module (of type "posixpath"),
> >
> Oh, is it?
>
> >>> import os.path
> >>> os.path
> <module 'ntpath' from 'c:\Program Files\Python\lib\ntpath.pyc'>
>
> :-)
Retroactive disclaimer: type is platform dependent ;-)
> >thus importing
> >os.path actually imports the os module. We might as well stop fooling
> >ourselves and import os explicitly (rather than importing os.path).
> >:-)
> >
> I think it's good style to import os.path and not os, it all we're using
> is stuff from the os.path module.
os.path is a variable; it just happens to reference a module. It
exists only to provide a OS-specific API for filesystem operations. I
disagree that it's good style to import variables. Doing so has
implicit side-effects which most people don't know about (but which I
admit aren't actually dangerous in the common case). Doing so ends up
creating a proliferation of statements like "import os, os.path" --
entirely unnecessary. As always, YMMV.
http://www.python.org/peps/pep-0008.html is related and is good
reading, but doesn't address this topic directly. The "A Foolish
Consistency is the Hobgoblin of Little Minds" section is probably my
favorite part.
--
Daniel Rall <dlr@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 12 00:09:49 2002