1. Preserve Maya selection (maya.cmds)
2. Run in "Settings > Working Units > Linear > centimeter" (PyMEL)
- Both examples show the good practice of using the optional, standard library, convenience function functools.wraps to not lose/overwrite the wrapped functions func.__name__, func.__doc__, ... docs: https://docs.python.org/2/library/functools.html#functools.wraps
- Theoretically both examples would be good cases for context managers. But practically it does not seem like a good fit to me: 1. preserve_selection: You should never write scripts that rely on selection changes during their execution (macro style copy/paste code vs proper programming). 2. Working units only ever make problems when they are something other than cm (in my experience).
- 2017-01-31: preserve_selection now works when a selected object gets deleted