[qmtest] RFE concerning 'Extension' class
Zack Weinberg
zack at codesourcery.com
Fri Jan 16 22:21:31 UTC 2004
Stefan Seefeld <seefeld at sympatico.ca> writes:
> hi there,
>
> I'd like to suggest some enhancements to the Extension class which
> (IMO) makes its use a bit cleaner.
>
> Right now each Extension class derivative has to declare its arguments
> within the class variable 'arguments', being a list of 'Fields'. These
> Fields are self-documenting, as they contain their name, description,
> and default value.
>
> In the Extension constructor this list is mapped to actual instance
> variables for convenient use, and the values are (possibly) overridden
> by arguments passed to the constructor.
>
> I'd suggest to create a metaclass for the 'Extension' type that handles
> this mapping in its '__init__' method.
This is a good idea. The present design of Extension was laid down
when QMTest still supported Python 1.5.2 so we couldn't use
metaclasses. There's several other places that could benefit from use
of metaclasses and other features of new-style objects; we just
haven't gotten round to doing the conversion.
> However, instead of scanning the content of the 'arguments' variable,
> it could scan the whole dictionary (of class variables) for variables
> of type 'Field'. That would avoid the potential naming collisions
> between class variables and fields, as fields *are* class variables.
I would like to see complete worked examples of this before I could
decide whether it was good or not.
zw
More information about the qmtest
mailing list