ansible/ansible — pull request #7831 by benosman (2014-06-19 13:06:41+00:00)
Title: Use isinstance() to type check dicts and lists.

Here is a pull-request in response to the post on ansible-devel.

https://groups.google.com/forum/#!topic/ansible-devel/d1eUS46H-ZM

I went a bit beyond the original thinking for consistency, I've converted all type checking for dicts AND lists to use is_instance.

All changes are straightforward, except for one in lib/ansible/utils/template.py, which should be checking whether the class is HostVars.

https://github.com/smoothify/ansible/commit/b677ec33ff5e5867b1f03c5b44a916ca53b18f58
Here, I had to add a scoped import to avoid a circular dependency error. Rather than importing, and using isinstance, an alternative method would be to check type(var).__name__ == 'HostVars'