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
else:
# 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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d77c44e7-1715-4241-abd0-8b665396fb35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To be honest, there isn't enough context here for me to really understand what you are trying to do. I would need to see a small real example to better understand the logic you want to achieve.
But the fact is that you can specifically check for "is None". The question is really how you want to use it to achieve some kind of goal here.
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/54b3089d-5e19-43d4-b520-fb7595632142%40googlegroups.com.
By the way, when I tried using
if selection_case is None:
...
It is not working as I expected it would output the same as in the code I have written
# The goal here is to find that value and # save it for later use. # We are dealing with a value # that can be either True or False. # First, we assign `None` to our variable value_true_or_false = None # Next, `value_true_or_false` variable is passed to # some function to get the value value_true_or_false = some_func_to_get_value(value_true_or_false) # At this point we want to save this value, but before saving it, # we need to check if the function has 'filled in' our value. # BAD (WILL FAIL) # Usually we are tempted to do this, if value_true_or_false: # Note: `if var` is more pythonic than `if var == True` save(value_true_or_false) # The above will work if setting_true_or_false is True, # but will NOT save the value if it is False! # GOOD (WILL WORK) # We want to save both the values either True or False, whatever it is. # So the correct way to do this is: if value_true_or_false is not None: save(value_true_or_false)
To be honest, there isn't enough context here for me to really understand what you are trying to do. I would need to see a small real example to better understand the logic you want to achieve.
But the fact is that you can specifically check for "is None". The question is really how you want to use it to achieve some kind of goal here.
On Sat, 24 Sep 2016, 4:34 AM yann19 <yang...@gmail.com> wrote:
Initially I had defined my selection_case to be False instead of None as I am not so sure which of the two I should put.There has been a function before this test() code I wrote that checks for selection. If there are no selections, it will return None. If there are selections, it will then check if the selections fulfills the nodetype criteria as defined in wihin sel_custom and sel_orig.Hence my usage of:if selection_case:...else:...In cases like this, should I just put it as selection_case = False instead?By the way, when I tried usingif selection_case is None:...--It is not working as I expected it would output the same as in the code I have written
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/54b3089d-5e19-43d4-b520-fb7595632142%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1-9oPa1%3DE-9bXOXyo%2BqnOmPp0PvV8ULnt-jnS4m7D2kQ%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.