[visionegg] Re: Proper use of ParameterTypes

  • From: Simeon Fitch <metasim@xxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Mon, 15 Aug 2005 15:05:20 -0400

Thanks! "Instance" is exactly what I wanted. 

As you can guess, I've tried to use the source code as a style
template to get a sense of the conventions you use. However, I'm still
not clear as to when one should use the ClassWithParameters framework,
vs. standard Python attributes. The type checking aspect of it is
really cool, as is the constructor argument parsing and defaults
handling, but I suspect there is a point where the extra dereferencing
work (e.g. p = self.parameters) leans one the other way.

Also, your class documentation and the parameters it accepts seem to
be well synchronized with the parameter declarations (including
defaults). Is this something you do manually, or do you have a pydoc
enhancement to handles this.

Thanks,

Simeon

On 8/15/05, Andrew Straw <astraw@xxxxxxxxxxx> wrote:
> Hi Simeon,
> 
> On Aug 15, 2005, at 5:56 AM, Simeon Fitch wrote:
> 
> > I have two questions about the use of ParameterTypes with
> > ClassWithParameters:
> >
> > 1) What's the role of the *MC classes? Integer vs. IntegerMC, AnyClass
> > vs. AnyClassMC, etc.?
> 
> They're metaclasses...  I can't remember why they were/are necessary. I
> think it's safe for you to ignore them.
> 
> > 2) I have a subclass of ClassWithParameters where one of the
> > parameters needs to be of a specific class. I'm not sure which
> > ParameterTypes class I should use; AnyClass, or Instance, or SubClass.
> > From the reference documentation it's not clear to me how to properly
> > use these.
> 
> I've added some minimal docstrings: see
> http://visionegg.org/cgi-bin/viewcvs.cgi/trunk/visionegg/src/
> ParameterTypes.py?rev=1340&view=markup
> 
> I think in most cases you'd want Instance. AnyClass or SubClass should
> be used if you want to use a class object as a parameter, not an
> instance of that class.
> 
> Cheers!
> Andrew
> 
> 
> ======================================
> The Vision Egg mailing list
> Archives: //www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
> 


-- 
Simeon H.K. Fitch, Owner
Mustard Seed Software
http://www.mseedsoft.com/
=====================================The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: