[Python-Dev] Metaclass insanity - another use case
Guido van Rossum
guido@python.org
Tue, 05 Nov 2002 21:32:27 -0500
> I've been wondering recently whether Python could benefit
> from having an "instance" statement which does for instances
> what the "class" statement does for classes.
>
> The idea is you'd be able to say something like
>
> instance isSpecification(model.Field):
> isRequired = 1
> qualifiedName = 'Foundation.Core.ModelElement.isSpecification'
>
> and it would be equivalent to
>
> isSpecification = model.Field(isRequired = 1,
> qualifiedName = 'Foundation.Core.ModelElement.isSpecification')
>
> One of the use cases I have in mind is GUI programming, where
> you frequently need to build complicated nested structures with
> lots of keyword arguments to constructors. A construct like this
> might help you to lay out the code more neatly and readably.
-1.
TOOWTDI.
--Guido van Rossum (home page: http://www.python.org/~guido/)