constructors (Re: [Bf-python] More Proposed API changes.)

Joe Eagar joeedh at gmail.com
Mon Mar 12 15:52:43 CET 2007


Toni Alatalo wrote:
> >>* A new or casual user has to remember that a slightly different 
> word is used to make the data and >>another is used to loop on it..
>
> i guess this hints what the difference in our thinking is: i want bpy 
> to be as normal Py as possible, while still making sense within the 
> Blender architecture. this might be different from what a Blender user 
> with no other Py experience expects. but still i would not differ from 
> other py lightly: even people who write simple scripts may have used 
> Py elsewhere too, like for web pages or games. and usually there 
> always is a constructor
The problem with constructors, is they imply independent types.  Nothing 
in bpy is "independant", nearly everything is part of linked lists.  A 
constructor of a type should create an independant, garbage-collectable 
instance of that type.  It shouldn't do other things, like automatically 
add the instance to
a linked list.  This is why the iterator.new() stuff is better, it tells 
the user what's really going on.

So if a user does, "mesh = bpy.Mesh()", is he going to realize that mesh 
is automatically added to bpy.meshes?  What will he think, when he 
realizes it isn't garbaged collected?

Anyway, just my 2 cents.

Joe



More information about the Bf-python mailing list