&gt; Disagree. The original commenter is correct in saying that the naming scheme is not obvious. Something like to_bytes(encoding) would be a lot more clear.<p>But then function would do something completely different. &quot;\x01\x02&quot;.encode(&#x27;zlib&#x27;) for instance is a bytes to bytes operation.  The problem is that &quot;foo&quot;.encode(&#x27;utf-8&#x27;) does not give you an exception.  If the coercion would not be enabled you would get an error:<p><pre><code>    &gt;&gt;&gt; reload(sys).setdefaultencoding(&#x27;undefined&#x27;)
    &gt;&gt;&gt; &#x27;foo&#x27;.encode(&#x27;utf-8&#x27;)
    Traceback (most recent call last):
      File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
      File &quot;&#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;python&#x2F;...&#x2F;encodings&#x2F;undefined.py&quot;, line 22, in decode
        raise UnicodeError(&quot;undefined encoding&quot;)
    UnicodeError: undefined encoding
</code></pre>
That&#x27;s not any worse than what Python 3 does:<p><pre><code>    &gt;&gt;&gt; b&#x27;foo&#x27;.encode(&#x27;utf-8&#x27;)
    Traceback (most recent call last):
      File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    AttributeError: &#x27;bytes&#x27; object has no attribute &#x27;encode&#x27;</code></pre>