[visionegg] Re: Proper use of ParameterTypes

  • From: Andrew Straw <astraw@xxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Mon, 15 Aug 2005 15:55:25 -0700

Simeon Fitch wrote:

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 idea is that any parameter that might be controlled with a Controller should use the whole ClassWithParameter stuff. (Obviously, if you never plan to use the FlowControl module, this is a non-issue.)


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.

Well, I know the feeling! :) Were I to write the Vision Egg from scratch today, I would use enthought's traits package, which does something similar (and lots of extra stuff) in a more elegant way. Unfortunately, traits was not available when I started.


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.

Yes, I run the "update_docstrings.py" script whenever I update the default parameters. I'm not sure it gets included with the source releases, but it's definitely in the source repository.


Cheers!
Andrew

======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: