C
C. B.
Hi everyone,
I'm currently coding a C library which provides several modules and
objects.
Let's say that some of these objects are classes called AAA and BBB.
The constructor of AAA needs to get BBB as argument.
So I can run the following code :
from mymodule import AAA
from mymodule import BBB
a = AAA(BBB()))
But, as there is no case where AAA can be used without BBB, I would
like to avoid importing BBB in my Python scripts when I already import
AAA.
For now, I think that reproducing the behavior of the __init__.py file
could be a good way to do this, but how can I code that using only the
C API ?
Are there any other solutions ? Is this kind of importation a good
idea ?
Greetings,
Cyrille Bagard
I'm currently coding a C library which provides several modules and
objects.
Let's say that some of these objects are classes called AAA and BBB.
The constructor of AAA needs to get BBB as argument.
So I can run the following code :
from mymodule import AAA
from mymodule import BBB
a = AAA(BBB()))
But, as there is no case where AAA can be used without BBB, I would
like to avoid importing BBB in my Python scripts when I already import
AAA.
For now, I think that reproducing the behavior of the __init__.py file
could be a good way to do this, but how can I code that using only the
C API ?
Are there any other solutions ? Is this kind of importation a good
idea ?
Greetings,
Cyrille Bagard