def path_types(obj, path):
result = []<EOL>cur = obj<EOL>for elem in path[:-<NUM_LIT:1>]:<EOL><INDENT>if ((issubclass(cur.__class__, MutableMapping) and elem in cur)):<EOL><INDENT>result.append([elem, cur[elem].__class__])<EOL>cur = cur[elem]<EOL><DEDENT>elif (issubclass(cur.__class__, MutableSequence) and int(elem) < len(cur)):<EOL><INDENT>elem = int(elem)<EOL>result.append([elem, cur[elem].__class__])<EOL>cur = cur[elem]<EOL><DEDENT>else:<EOL><INDENT>result.append([elem, dict])<EOL><DEDENT><DEDENT>try:<EOL><INDENT>try:<EOL><INDENT>result.append([path[-<NUM_LIT:1>], cur[path[-<NUM_LIT:1>]].__class__])<EOL><DEDENT>except TypeError:<EOL><INDENT>result.append([path[-<NUM_LIT:1>], cur[int(path[-<NUM_LIT:1>])].__class__])<EOL><DEDENT><DEDENT>except (KeyError, IndexError):<EOL><INDENT>result.append([path[-<NUM_LIT:1>], path[-<NUM_LIT:1>].__class__])<EOL><DEDENT>return result<EOL>
Given a list of path name elements, return anew list of [name, type] path components, given the reference object.