Skip to content

Instantly share code, notes, and snippets.

@axiaoxin
Last active August 29, 2015 14:06
Show Gist options
  • Save axiaoxin/5ac3ddf0207c0543f7ea to your computer and use it in GitHub Desktop.
Save axiaoxin/5ac3ddf0207c0543f7ea to your computer and use it in GitHub Desktop.
__parse_dict_depth
def __parse_dict_depth(self, d, depth=0):
if not isinstance(d, dict) or not d:
return depth
return max(self.__parse_dict_depth(v, depth+1) for k, v in d.iteritems())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment