On Friday, 16 March 2018 11:44:02 UTC+11, Justin Israel wrote:
> On Fri, Mar 16, 2018, 11:47 AM Michael Boon <[email protected] > <javascript:>> wrote: > >> No matter what name I import maya.cmds as (including simply importing it >> as maya.cmds) I add that name to the global namespace. >> I think the robust approach is to choose an obviously temp name (or check >> for the existence of a name and back it up, but that seems like overkill), >> and delete it afterwards >> import maya.cmds as _temp_cmds >> # ... Do stuff with the __doc__ ... >> del _temp_cmds >> > > We are missing each other on this point. > Argh and I hate that :\ > I'm advocating the other way around. What is 100% expected is to use the > exact fully qualified module path that Maya ships with as opposed to > picking your own alias that you like best. I agree that in both cases you > leave behind an imported module but at least one of them is full qualified. > You shouldn't delete any of them after either, since you could be deleting > something previously imported unkess you check first. > What's better about a fully qualified module name, and what makes it "100% expected"? Do you just mean that it's relatively unambiguous what "maya.cmds" is? Both approaches have the problem that they could theoretically change the way scripts behave depending on whether my plugin is loaded or not. One redefines "cmds" and the other redefines "maya". But we are probably overly nitpicking this point to death :-) > Yeah this is unlikely to have any practical effects. I still hate the fact that I don't understand what you mean! -- 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/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
