On Mon, Mar 19, 2018, 10:45 PM Marcus Ottosson <[email protected]>
wrote:

> I find examples are often the best way of getting a point across, and I
> think what Justin is saying is that in place of this..
>

It's really a team effort. I'm more of a big picture idea man, and you are
like the front man in the band.

import maya.cmds as _temp_cmds
>
> You do..
>
> import maya.cmds
>
> And then use maya.cmds wherever you would normally use _temp_cmds. This
> way, nothing is redefined and nothing needs cleaning up. And you’ve even
> saved yourself from typing one character less. :)
> ​
>
> On 19 March 2018 at 00:28, Justin Israel <[email protected]> wrote:
>
>>
>>
>> On Mon, Mar 19, 2018 at 1:06 PM Michael Boon <[email protected]> wrote:
>>
>>>
>>>
>>> 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]> 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".
>>>
>>
>> In my mind, the "maya" root namespace is shipped with Maya's
>> site-package, so if I am going to leave symbols in the shared global python
>> namespace I would want to leave them full qualified instead of choosing
>> aliases or "from" imports.
>>
>>
>>>
>>> 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
>>> <https://groups.google.com/d/msgid/python_inside_maya/1e417eb3-c781-4923-8959-885fc4bc80a6%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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/CAPGFgA0-mw-Gsyg5p-J9L_tph41%2Bi98DV4ii304YG1m02eXU0Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0-mw-Gsyg5p-J9L_tph41%2Bi98DV4ii304YG1m02eXU0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAFRtmOAFs%2BTdA3CahbeGzU-fJdk2kWp%3D_dwB_j5WvpgJaLzO2w%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAFs%2BTdA3CahbeGzU-fJdk2kWp%3D_dwB_j5WvpgJaLzO2w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to