if str(type(obj)) == "<class '{}.{}'>".format(os.path.splitext(os.path.
basename("__file__")[0]),self.__class__.__name__):

I find this line you mentioned quite confusing, for a few reasons. First,
getting the basename of a string literal "__file__" is not doing what you
probably expect. It was probably meant to be used without the quotes, as
the magic variable for the current file name.

Why was this particular approach used with the goal of finding out if the
object is an instance of the current class? Do these other options not work?

   1. isinstance()
   2. obj.__class__ is self.__class__
   3. hasattr() duck typing

Relying on the string representation comparison seems like it would easily
fail.

Justin

On Fri, Nov 17, 2017 at 12:38 PM vilkdage <[email protected]> wrote:

>

-- 
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/CAPGFgA2DKE2Lnz6cFhNkc0SXnuGTHkmxWDuisbB93D1SuKF0gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to