There can be times when you need to distinguish between a True/False
setting and also whether the setting is even been set at all. That would
call for having the None value. An example would be if you accepted a
boolean option from a user, but you also want to know if the option has
even been provided by the user at all. None could be the value when the
option has not even been set.
But, in the way you are using it here, there is a problem. You are doing a
"truthy" test on the value of selection_case. Both False and None evaluate
to False when tested like that:
So when your selection_case is False or None, the "else" block will
succeed. If you need to know the difference between False and None, then
if selection_case is None:
On Fri, Sep 23, 2016 at 4:58 PM yann19 <yangki...@gmail.com> wrote:
> Hi all,
> I would like to ask for opinion where I am using Boolean to test my
> 'selection' case.
> In the following code, the boolean term for this scenario is called
> I am sure that there is a term for such scenarios but I am not sure what
> it is called
> In anyways, can someone kindly help take a look at my code and advise if I
> am on the right track? Is defining selection_case as None the right choice?
> def test():
> selection_case = None
> # If the selection type is the apkgStack
> if sel_custom:
> selection_case = True
> if sel_org:
> selection_case = False
> while not check:
> if selection_case:
> # perform this set of stuff
> # perform the other set of stuff
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.