def checkAssetDefinition(self, object, fileType):object = str(object)for attr in self.xmlAssetDefsList:if object.startswith(attr):innerDict = self.xmlAssetDefsList.get(attr)for myType in innerDict:if myType == fileType:configVar = innerDict.get(myType)config.configVar.append(myType) ???# Need to get the config variable from the config list variable
I don't know much about what type of object your config instance is (you referred to is as a config file global list), but maybe what you want is a dictionary? Sometimes it is very useful to be able to access attributes dynamically via string names, and sometimes people try to do it in place of really just using a dict for the variable key names.
It may be a completely wrong suggestion for what you are doing, but does the type of this config object require there to be first class attributes? If the Config object is what it is and you can't really change the way it exposes values, then maybe the getattr approach is the right choice to map string attribute names from an xml to an object.
--
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/497423a5-e64e-4ee0-b5a8-ff367448c6db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/sWXrW8kfsUE/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAPGFgA1a2pHka-D5Bxn4K%3DpY1v9rbHQiK0yu_GkE9rmpVyUjJw%40mail.gmail.com.
If it works and makes sense to you, then keep doing it. Python is pretty magical with all the introspection capabilities that it offers. If you come up with a clean way to solve your problem and you are happy with it, then no reason to change it.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkVkPO362DrOe%2BcUjUyLisL5Udw-SdH-g-hnEaGVuXuT3Q%40mail.gmail.com.