The Python Unicode Mess
Getting Unicode right, especially with various file systems and cross-platform implementations is hard, for sure.  But, I think this quote:<p>&quot;And, whatever you do, don’t accidentally write if filetype == &quot;file&quot; — that will silently always evaluate to False, because &quot;file&quot; tests different than b&quot;file&quot;. Not that I, uhm, wrote that and didn’t notice it at first…&quot;<p>shows a behavior that, to me, is inexcusable.  The encoding of a string should never cause a comparison to fail when the two strings are equivalent <i>except for the encoding</i>.  For example, in Delphi&#x2F;FreePascal, if you compare an AnsiString or UTF-8-encoded string with a Unicode string that is equivalent, you get the correct answer: they are equal.