[Python-ideas] PEP 3155 - Qualified name for classes and functions

Éric Araujo merwok at netwok.org
Mon Nov 7 17:19:34 CET 2011


Le 07/11/2011 16:34, Barry Warsaw a écrit :
> Nice PEP, and +1 for the concept (with Guido's preferred format).  However,
> "qname" is pretty obscure and I only guessed what the "q" stood for by reading
> the title of the PEP.
OTOH, qname will be easily found in search engine (one of my griefs with
the “packaging” module name).

> It seems to me that this attribute represents the dotted path from module
> globals to the object.  You have to be careful not to confuse this with a file
> system path, so something like __dotted_name__, __dotted_path__, or
> __full_name__ perhaps.  I don't much care, but I do think cryptic
> abbreviations should be avoided.
-1 on these propositions: A dotted name or path includes the module name
for me (or for things like packaging.util.resolve_name).  I’m less
affirmative about “full name”; it could mean “full name in one module”,
so that __module__ + __fullname__ == the fully qualified name.  This
terminology is not terrific: I don’t think it would be good to have a
distinction between “full name” (a.b) and “fully qualified name”
(module.a.b).  I think “qualified name” and “fully qualified name” are
better terms: “qualified” has IMO less assumptions than full (you ask
yourself “in what way is it qualified?” and go to the docs, instead of
thinking “ah, it’s the full name including the module” or “ah, it’s like
__name__ but better, and without the module”), and “fully qualified”
builds on “qualified”.

(I’m trying to be constructive, not bikeshedding; tell me if I fail.)

__qualname__ is less cryptic and not too long; __qualifiedname__ is even
less cryptic.

Cheers



More information about the Python-ideas mailing list