title: How to check that two python pathlib.Path have the same parents?
body: <p>With two <code>Path</code> objects that share the same parent paths, how do you compare them to assert that they do in fact share the same parents?</p>
  
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; list(Path(input).parents)
  [PosixPath('/usr/src/app'), PosixPath('/usr/src'), PosixPath('/usr'), PosixPath('/')]
  &gt;&gt;&gt; list(Path(output).parents)
  [PosixPath('/usr/src/app'), PosixPath('/usr/src'), PosixPath('/usr'), PosixPath('/')]
  &gt;&gt;&gt; Path(input).parents == Path(output).parents
  False
  
  # huh?
  </code></pre>
  
  <p>Although the following works, it seems awkward to cast it to a <code>List</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; list(Path(input).parents) == list(Path(output).parents)
  True
  </code></pre>