Automatic import ?
nocbos at gmail.com
Sat Mar 27 23:39:23 CET 2010
> In that particular case, replace automatic by implicit, and you got the
> reason why it is not a good idea.
> Maybe in your case the C habits clashes to the python habits.
You're right !
As a C developer, I appreciate to only include <string.h> to deal with
strings, without wondering which other header provides size_t
> Talking about python, if the user needs to know about BBB, then it has
> to import it, perdiod. If the user needs to know about many objects,
> then it has to import them all, explicitly.
Ok. If this is the Python way of coding, that's ok for me. I will stop
now my quest for an automatic import and work like that.
The most interesting solution I have found until now is using
PyImport_AppendInittab() and PyEval_GetGlobals() functions. But this
also brings lots of problems (mainly namespaces and unloading).
Anyway, the time spent to look for a solution was a nice way to learn
Python internals :)
More information about the Python-list