[Bf-python] More Proposed API changes.

Ken Hughes khughes at pacific.edu
Mon Mar 12 17:22:24 CET 2007


Toni Alatalo wrote:
> Campbell Barton kirjoitti:
>> http://members.optusnet.com.au/cjbarton/BPY_API/Bpy-module.html
> 
> nice.
> 
> i am concerned about having the module auto-imported though. "explicit 
> is better than implicit". nothing like that is usually automagically 
> 'there' in python. admittedly, as bpy is embedded, it makes sense that 
> the embedded env is there (it is already loaded in memory - which is 
> what import normally does). but i think it can be confusing: we get two 
> kinds of scripts, ones with Blender imported and others where bpy just 
> is there .. what if we later want/need to change so that some other name 
> is used for some other kind of module? like there is the alternative 
> 'blendit' module. also there is the remote chance of a conflict: someone 
> wanting to use a py script in Blender that has the name 'bpy' - without 
> explicit import he can not do 'import bpy as bpython' or whatever could 
> be used otherwise to avoid it.

Just to give an alternative viewpoint, I like the auto-import.  (I'm not 
sure if you changed your mind in your follow-up e-mail:
   "letting this sink more, this feels like the greatest thing for bpy 
:)  "

There is a precedent for things to be "automagically" there in python. 
We have the entire set of __builtin__ methods and, of course, the 
datatypes like tuple, list and dict.  Additionally, there are the 
special variables like __main__ which automagically exist.

Ken



More information about the Bf-python mailing list