Python OOP Problem
Laszlo Nagy
gandalf at shopzeus.com
Tue Dec 29 08:35:27 EST 2009
> Thanks for reply, but it doesn't fit to my task. If I will add later
> other objects(and it will be very often) - I should stop the service,
> but that would be very bad.
>
I think you meant "if you add other classes".
> I'm not sure, if this is solution, but test passed:
>
> myimportmod = __import__('ClassName', globals(), locals(),
> ['ClassName'], -1)
> mod = getattr(_myimportmod, 'ClassName')
> o = mod();
> o.myfunction();
>
The same way you can say: this won't work if you need to change your
'ClassName' class. That would require restart of your service. Then you
can use reload(). However, I do not see the big picture. What is your
program suppose to do?
L
More information about the Python-list
mailing list