accessing a classes code

Ryan Krauss ryanlists at gmail.com
Wed Apr 19 15:40:39 EDT 2006


It turns out that what I want to do can be done using the inspect
module which has methods for getsourcecode among other things.

Ryan

On 4/19/06, bruno at modulix <onurb at xiludom.gro> wrote:
> Ryan Krauss wrote:
> (top-post corrected)
> >
> > On 4/19/06, bruno at modulix <onurb at xiludom.gro> wrote:
> >
> >>Ryan Krauss wrote:
> >>
> >>>I have a set of Python classes that represent elements in a structural
> >>>model for vibration modeling (sort of like FEA).  Some of the
> >>>parameters of the model are initially unknown and I do some system
> >>>identification to determine the parameters.  After I determine these
> >>>unknown parameters, I would like to substitute them back into the
> >>>model and save the model as a new python class.
> >>
> >>Why ? Python is dynamic enough to let you modify classes at runtime...
>
> > Because I want to store the results in one place so that in order to
> > use the code later, all I have to do is import the classes that
> > include the parameters that were previously unknown.  I want to make
> > using the results as easy and clean as possible for other users.
> >
>
> I'm afraid you're still thinking in terms of the solution instead of
> thinking in terms of the problem to solve. The fact that classes can be
> modified at runtime doesn't means that client code needs to be aware of
> what happens.
>
>
> --
> bruno desthuilliers
> python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
> p in 'onurb at xiludom.gro'.split('@')])"
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list