return an object of a different class
Ben Finney
ben+python at benfinney.id.au
Wed Feb 16 01:03:20 EST 2011
More information about the Python-list mailing list
Wed Feb 16 01:03:20 EST 2011
- Previous message (by thread): return an object of a different class
- Next message (by thread): return an object of a different class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): return an object of a different class
- Next message (by thread): return an object of a different class
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list