1

I've a class:

class A(SomeModule)

How to get the module extended by class A (SomeModule) ?

I cannot use isinstance() function to achieve this, thanks before

2
  • That example doesn't make sense. Classes don't inherit from modules, they inherit from other classes. Commented Mar 28, 2014 at 4:26
  • I see.. this is my mistake, That's why I find it quite weird, I'm quite new in python, thanks for the answer, is there any way to delete this stupid question ? haha Commented Mar 28, 2014 at 4:34

1 Answer 1

2

A module is just a static bag of classes and functions. It is not instantiable, so it is not even clear what you mean by having a class "extend" a module.

If you intend to end up with a module that has all the members of SomeModule and then some, create a module that imports SomeModule and define some more members. If you intend to end up with an instantiable class that has some (or all) of the functions in SomeModule, import SomeModule where you are defining your class, and invoke those functions from within your class methods.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.