Class or Dictionary?

Dave Angel davea at ieee.org
Mon Feb 14 10:51:20 CET 2011


On 01/-10/-28163 02:59 PM, Martin De Kauwe wrote:
> <snip>
>
> from other_model import OtherSubModel
> class Model:
>
>      def __init__(self):
>
>          # included other external modules (i.e. in other files)
>          om =therSubModel()
>
>      def run(self):
>          # call other submodel and pass params
>          om.run(params)
>

What's om supposed to be?  You define a local variable in one method, 
and try to use it in a different one ????

Perhaps you meant  self.om =

 > class OtherSubModel:
 >     def __init__(self):
 >         #some stuff
 >
 >     def run(params):

You're missing a self here in the formal parameter list.

DaveA



More information about the Python-list mailing list