[Bf-python] nmesh.getMode() nmesh.setMode : inconsistent !

Gert De Roost paleajed at yahoo.com
Mon Feb 21 00:53:04 CET 2005


On Sat, 19 Feb 2005 13:23:50 -0500, Stephen Swaney
wrote:
> All of our bpy get/set methods *should* interoperate

> with .set( .get() ) as a standard idiom.

> A common api convention is for .set() methods to
return
> the current (before change) state so it can be saved
for later restore.

It does indeed work like this for getMode() en
setMode().  I was just misled by the API
documentation, which only mentions setMode() using
strings as parameters.  I believe API docs could be
more comprehensive (like mentioning the above
convention for .set()).  Still I am glad to see I was
wrong about this consistency issue.

Sat, 19 Feb 2005 21:14:12 +0100, Yann Vernier
<yann at algonet.se> wrote:
> > 	if len(modes) == 0:
> > 		mesh.setMode()
> > 	if len(modes) == 1:
> > 		mesh.setMode(modes[0])
> > 	if len(modes) == 2:
> > 		mesh.setMode(modes[0], modes[1])
> > 	if len(modes) == 3:
> > 		mesh.setMode(modes[0], modes[1], modes[2])
> > 	if len(modes) == 4:
> > 		mesh.setMode(modes[0], modes[1], modes[2],
> modes[3])
> 
> Really, it is much easier to use
> mesh.setMode(*modes).

Thanks very much, I learned Python by quickly drilling
myself reading some parts of "An Introduction to
Python" by Guido van Rossum and Fred L. Drake, Jr..  I
did not learn about the * operator.  It will come in
handy...

.gert.



	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail



More information about the Bf-python mailing list