[Python-3000] Draft pre-PEP: function annotations
paul at prescod.net
Sun Aug 13 02:05:56 CEST 2006
It seems to me that there are two very reasonable positions being expressed.
Is the following (non-normative) text a compromise?
"In order for processors of function annotations to work interoperably, they
must use a common interpretation of objects used as annotations on a
particular function. For example, one might interpret string annotations as
docstrings. Another might interpet them as path segments for a web
framework. For this reason, function annotation processors SHOULD avoid
assigning processor-specific meanings to types defined outside of the
processor's framework. For example, a Django processor could process
annotations of a type defined in a Zope package, but Zope's creators should
be considered the authorities on the type's meaning for the same reasons
that they would be considered authorities on the semantics of classes or
methods in their packages. This implies that the interpretation of built-in
types would be controlled by Python's developers and documented in Python's
documentation. This is just a best practice. Nothing in the language can or
should enforce this practice and there may be a few domains where there is a
strong argument for violating it (e.g. an education environment where saving
keystrokes may be more important than easing interopability)."
"In Python 3000, semantics will be attached to the following types:
basestring and its subtypes are to be used for documentation (though they
are not necessarily the exclusive source of documentation about the type).
List and its subtypes are to be used for attaching multiple independent
(does chaining make sense in this context?)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-3000