[RFC] Changes to 'selftest --starting-with'

Harald Meland harald.meland at usit.uio.no
Wed Aug 27 10:49:47 BST 2008


[Vincent Ladeuil]

>>>>>> "Harald" == Harald Meland <harald.meland at usit.uio.no> writes:
>
>     Harald> [Vincent Ladeuil]
>     >> I'd like to find a solution that do not conflict with valid
>     >> package names.
>     >> 
>     >> One is to use '.' as the leading character so that we can do:
>     >> 
>     >> .bt => bzrlib.tests
>     >> .bp => bzrlib.plugins
>     >> .gtk => bzrlib.plugins.gtk
>
>     Harald> PEP 328 uses leading dot(s) in the package name part of import
>     Harald> statements to indicate that the import should be relative, so the
>     Harald> above alias syntax will probably become somewhat confusing when such
>     Harald> relative imports become a more widely known feature.
>
> That's where I got the idea.
>
> Why do you find it confusing though ? This will only be used on
> the command line, not inside a python package.

Sure, but to my mind the relative import syntax is somehow related to
the "relative to current directory" syntax in the shell
(i.e. "./foobar").

My (uneducated by your explanation below) guess as to what giving a
dot-prefixed "module name" on the command line would do, would be
"look for that module name relative to the current directory"; i.e. if
my cwd was bzrlib/tests, doing "-s .blackbox" would be equivalent to
"-s bzrlib.tests.blackbox".

> It could even be documented as: "Prefixes can be viewed as
> 'import bzrlib.tests as bt' inside a fictional command-line
> python name space".
>
> Does that address the confusion ?

I understand that there is a difference in using a module name in
actual Python code, and in using something that looks like a module
name on the command line.  Adding documentation to explain why the
seeming similarity really isn't looks like a workaround rather than a
solution to me.

Why not use a leading ":" to indicate alias, like the "remembered
location" aliases :parent, :public, etc.?
-- 
Harald



More information about the bazaar mailing list