[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 3734 - trunk/subversion/tests/clients/cmdline

From: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2002-11-12 00:09:11 CET

=?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

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.