Relative-importing *
Ben Finney
bignose+hates-spam at benfinney.id.au
Sat Aug 4 10:10:00 EDT 2007
rbygscrsepda at gmail.com writes:
> Yes, I'm importing * for a reason, a good one, I think.
Reading your description, I must say I don't see a good reason.
> I have a set of modules (the number planned to reach about 400) that
> would be dynamically loaded by my program as needed, and they're
> somewhat similar to each other. I wish each of them to import * from
> a certain "parent" module, so that they'll receive whatever
> functions and variables I want all of them to share (using the
> parent module's __all__), which may be overrided by the "child"
> modules at their discretion. Sort of like class inheritance, but I'm
> not doing that because implementing that would be a lot more tedious
> and less elegant.
It seems to me, based only on this description, that class inheritance
would be far *more* elegant, and much easier to follow when reading
the code.
If all these functions and other objects are so closely-related that
they form the core of some inheritance-like system, what's so
inelegant about wrapping them in a class so that the inheritance is
explicit in the module where it happens?
--
\ "The only tyrant I accept in this world is the still voice |
`\ within." -- Mahatma Gandhi |
_o__) |
Ben Finney
More information about the Python-list
mailing list