[Bf-python] boolean check bug in Armature_setDrawAxes

Gilbert, Joseph T. jgilbert at tigr.ORG
Fri Dec 23 18:34:13 CET 2005


That is correct anything not None, 0 or False evaluates to True using
PyObject_IsTrue. I understand that and I intentionally implemented all
Boolean members in Armature to take True/False. 
In a sense yes, Armature.member = 'wasssup' can technically be
considered a valid Boolean but I thought restricting this to True/False
would make more sense. 

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Stephen
Swaney
Sent: Friday, December 23, 2005 12:05 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] boolean check bug in Armature_setDrawAxes

On Fri, Dec 23, 2005 at 10:45:15AM -0500, Gilbert, Joseph T. wrote:
> 
> Couple things:
> 1.There have been a number of ways to parse Boolean values in the api
> and I think this is something else that needs overhaul for the 2.40
api.
> Lets add this to the wiki.
> 2. PyObject_IsTrue evaluates any positive integer as true. It is
equally
> valid using PyObject_IsTrue to write Armature.drawAxes = 500.
Therefore
> I don't see it as 'wrong' that the user pass True/False to a Boolean
> method and not an integer.

You are missing the point here.  The code as written checks only for a
Boolean object.

In Python, a whole slew of things evaluate as True; basically anything
that is not False, None, zero or null.  Look at the source for the
PyObject_IsTrue method to see examples.

-- 
Stephen Swaney			
sswaney at centurytel.net

_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list