Edxz
Edxz

Reputation: 823

Get The Module Extended By a Class

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

Upvotes: 1

Views: 58

Answers (1)

user1726343
user1726343

Reputation:

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.

Upvotes: 2

Related Questions