[Python-ideas] Add from __experimental__ import bla [was: Should we move to replace re with regex?]

Nick Coghlan ncoghlan at gmail.com
Tue Aug 30 05:03:10 CEST 2011


On Tue, Aug 30, 2011 at 11:22 AM, Bruce Leban <bruce at leapyear.org> wrote:
> Unlike __future__ the API is unstable and therefore code that works with
> today's __experimental__ may fail tomorrow. If the API changes in an
> incompatible way, we would probably prefer that the import fail rather than
> succeed with random results. Therefore, I would propose a mechanism to
> support this, perhaps something like
>
> from __experimental__ import regex {2,3,4} as re

I'd advise against trying to overengineer this. If we decide to go
down the path of breaking imports, then we'd probably just do it via
naming conventions (e.g. give all experimental modules a suffix based
on the Python version where they were first included).

However, if you're concerned about subtle breakage due to backwards
incompatibilities, then that's a good sign that depending on
explicitly experimental modules is a *bad idea*.

Adding a package specifically for candidate standard library modules
with APIs that aren't yet locked in would be easy and low impact.
Messing with the compiler or interpreter to provide additional
features would be much higher impact, and consequently a much harder
sell.

However, you've highlighted the major problem with the idea: just
because we *say* that the package is experimental and APIs may change
without (programmatic) warning, doesn't mean people will pay
attention. There are also a whole host of serialisation problems that
arise when dealing with relocated modules, which could cause issues
with the eventual migration to the "real" module location.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list