There's a fundamental problem with this in my view, the dounder init method of a class gets executed _after_ the instance (aka self) get created, doing checks there means you basically create an object that can potentially be invalid by passing the wrong thing and that's a problem.
You could use a classmethod instead or even a dounder new, but I would go the other way around by using a simple function instead! Classes are a very powerful tool but it's a bit overkill on this case (imho anyway). Cheers! -- 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/CAPamJi9JY90vPHxJxaNJpU2C3D6zPix1TUv%2BcfXmMTN1gTW-5g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
