[Python-3000] Adaptation and type declarations

Guido van Rossum guido at python.org
Tue Apr 11 20:21:41 CEST 2006


On 4/11/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> You had said there was some question of what kind of objects the type
> markers should be.  I couldn't (and still can't) see any good reason
> for them to be anything but a way to ensure [to some level] that the
> argument is [in some way] appropriate.

You just can't avoid using a double negative can't you? :-)

I'd like to stretch the definition further, so that *any* argument
metadata can be placed in that syntactic position, as long as a
decorator is used that can interpret the metadata, and as long as the
metadata can be expressed as a single expression. (If the expression
gets too long we can always lift it out and move it to a preceding
position in the file, as the expression is evaluated at the same time
the function definition and the default values are -- I probably
forgot to make that explicit.)

Just like decorators have no defined semantics (beyond "the decorator
gets called this way and what it returns gets assigned to that
variable") but have found a few well-defined conventions for their
most common usage (call wrappers and registration), I expect that
we'll develop a convention for how to express various useful metadata
soon enough -- but I don't want the language to enforce that. The
syntactic position is much too precious to assign it a single specific
meaning.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list