return an object of a different class
Ben Finney
ben+python at benfinney.id.au
Wed Feb 16 01:03:20 EST 2011
spam at uce.gov writes:
> I didn't explain my problem, chose a terrible example. This is more
> what I'm trying to do:
Unfortunately, it's still very contrived, and the names don't give any
suggestion as to what you're trying to achieve. Can you improve on that?
> class ThingyTypeA:
> def __init__(self):
> # do some further extraction specific to type A
> further_extract()
>
>
> class ThingyTypeB:
> def __init__(self):
> # do some further extraction specific to type B
> further_extract()
Perhaps you want those classes to inherit from your base class. Have you
done the Python tutorial? It covers inheritance and how to use it.
--
\ “Are you pondering what I'm pondering?” “I think so, Brain, but |
`\ I don't think Kay Ballard's in the union.” —_Pinky and The |
_o__) Brain_ |
Ben Finney
More information about the Python-list
mailing list