<div class="gmail_quote">On Thu, Apr 9, 2009 at 6:01 AM, Barry Warsaw <span dir="ltr">&lt;<a href="mailto:barry@python.org">barry@python.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Anyway, aside from that decision, I haven&#39;t come up with an elegant way to allow /output/ in both bytes and strings (input is I think theoretically easier by sniffing the arguments).<br>
</blockquote></div><br>Won&#39;t this work? (assuming dumps() always returns a string)<br><br>def dumpb(obj, encoding=&#39;utf-8&#39;, *args, **kw):<br>    s = dumps(obj, *args, **kw)<br>    return s.encode(encoding)<br>
<blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>