Thanks, I think that's much clearer. In this case, one immediate advantage of using a bool is performance. Querying a boolean is simply faster than calling a function.
If performance wasn't an issue, then I would likely still opt for a boolean as a means of communicating what it is being used for. You could argue that you should always pass the full APIs of objects around, to maximise your ability to take full advantage of them wherever they are being intercepted. In my experience this leads to brittle and stale code. Consider for example if you made a change to your code whereby you were no longer using `MPlug` to retrieve plug dirtiness. What if there was a faster method? In that case, you will either have to (1) instantiate a dedicated `MPlug` simply to pass it along (slow), (2) build your own `MPlug` replica that mirror the interface of the original `MPlug` such that any method using the member still works (slower), or (3) refactor anything that uses that member variable to use the new return value (painful, maybe). If instead all you passed was a boolean, then the odds are greater that you'd be able to use the new method, and still pass a boolean. Subsequent methods could remain untouched (and blissfully unaware of your improvement). -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOB_8T3q03UrPtPanvCEz1b53oByiV39nhBFru02f7xF2g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
