I have a few related classes sitting in a package like this:
\cool
\__init__.py
class CoolObj: ...
class CoolStr(CoolObj): ...
class CoolName(CoolStr): ...
class CoolSound(CoolObj): ...
And I use these classes like this:
import cool
cn = cool.CoolName()
...
This __init__.py
file is getting too long. It would be nice if I could put each class in each of their own file like this:
\cool
\__init__.py
\cool_obj.py
class CoolObj: ...
\cool_str.py
class CoolStr(CoolStr): ...
\cool_name.py
class CoolName(CoolStr): ...
\cool_sound.py
class CoolSound(CoolObj): ...
However, this way, these files becomes modules and I'd have to use them as below, which is a little verbose.
from cool import cool_obj, cool_str, cool_name, cool_sound
cn = cool_name.CoolName()
Is there anyway that can put source code in separate file while still be able to refer to them with concise syntax like I do now?
Better even, is there anything in python
like partial class in C#
that allows you to spread implementation of the same class in different files?