<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I don't have a particular solution mind. Just
wanted to reframe the question</FONT></DIV>
<DIV><FONT face=Arial size=2>to be a more general one about the controlling the
selection between near</FONT></DIV>
<DIV><FONT face=Arial size=2>equivalent modules and extensions. Some
variant of the problem seems to</FONT></DIV>
<DIV><FONT face=Arial size=2>come-up in many different contexts. No one
best practice has emerged as</FONT></DIV>
<DIV><FONT face=Arial size=2>dominant. </FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=brett@python.org href="mailto:brett@python.org">Brett Cannon</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=python@rcn.com
href="mailto:python@rcn.com">Raymond Hettinger</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=python-dev@python.org
href="mailto:python-dev@python.org">Python Dev</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, February 20, 2009 12:41
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Python-Dev] Choosing a best
practice solution for Python/extensionmodules</DIV>
<DIV><BR></DIV><BR><BR>
<DIV class=gmail_quote>On Fri, Feb 20, 2009 at 12:33, Raymond Hettinger <SPAN
dir=ltr><<A href="mailto:python@rcn.com">python@rcn.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">[Brett]
<DIV class=Ih2E3d><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">With
io getting rewritten as an extension module, I think it's time to try to
come up with a good best practice scenario for how to be able to control
when 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. 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. 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></BLOCKQUOTE></BODY></HTML>