<br><br><div class="gmail_quote">On Fri, Feb 20, 2009 at 12:33, Raymond Hettinger <span dir="ltr">&lt;<a href="mailto:python@rcn.com">python@rcn.com</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;">
[Brett]<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
With io getting rewritten as an extension module, I think it&#39;s time to try to come up with a good best practice scenario for how to be able to control when &nbsp;a module uses a pure Python implementation and when it uses extension module optimizations. This is really only important for testing as if the extension is missing then the pure Python version is just flat-out used.<br>

</blockquote>
<br></div>
There is also need in some modules where the two are not exactly equivalent<br>
or where there are multiple C extensions to choose from. &nbsp;In PyYAML, there needs to be an easier way to switch parsers and emitters (i.e. LibYAML).<br>
There are similar issues with xmlrpclib with the choice of parsers, marshallers,<br>
and unmarshallers. &nbsp;Possibly, the same mechanism can offer the user more<br>
control over which dbm is used when there are several choices.<font color="#888888"></font></blockquote><div><br>So are you saying you want something that takes multiple arguments like ``use_extension(py_name, *ext_names)``? Or are you wanting to go down the road of modules needing to define their own functions to use or unwind changes?<br>
<br>-Brett<br></div></div><br>