Bruno Desthuilliers <[email protected]> writes:
> Anyway: the simplest solution here is to replace the call to your Base
> class with a call to a factory function. I'd probably go for something
> like (Q&D untested code and other usual warnings) :
>
> (...)
Yeah, that will do what I want.
My confusion arose from the expectation that there had to be some
mechanism to do the conversion automatically. But actually a simple
def bar(arg):
if not isinstance(arg, Base):
arg = Base(arg)
# Do something with arg.
is a simple and explicit solution of the problem.
Thanks
Christoph
--
http://mail.python.org/mailman/listinfo/python-list