Automatic import ?

C. B. nocbos at gmail.com
Fri Mar 26 21:18:07 EDT 2010


At first, thank you all for your answers.

Some more details about what I'm coding and what I need...

The classes AAA and BBB are just given as examples. In fact, BBB's
constructor accepts several parameters, meaning it can be different
for each creation of AAA. So it can't be simply skipped from the AAA's
one, even if there can be a default value.

Making AAA do the call to BBB is a solution, but, in that case, the
end-user loses the reference to the used BBB instance.

Concerning the reason why I wish to avoid importing, once again AAA
and BBB were just examples. I plan to add more classes, so AAA will
also need CCC, DDD, and so on to work.

It takes time to write the relative importations, that's ok, but I
think it could be more pleasant for the end-user to not have to write
a huge list of "from mymodule import xxx" if it is possible to take
advantage of automatic importations.

Cheers,



More information about the Python-list mailing list