[Python-ideas] Putting `blist` into collections module
Steven D'Aprano
steve at pearwood.info
Sun Sep 21 06:37:39 CEST 2014
On Sat, Sep 20, 2014 at 08:18:54AM -0700, Ram Rachum wrote:
> Hi everybody,
>
> In 2007, this PEP was created that suggested integrating Daniel Stutzbach's
> blist into Python: http://legacy.python.org/dev/peps/pep-3128/
>
> The PEP was rejected, but Raymond Hettinger made a note that "after a few
> months, I intend to poll comp.lang.python for BList success stories. If
> they exist, then I have no problem with inclusion in the collections
> module."
I have not used blist, but I have no objection to it becoming a
collections type if the author agrees.
> I realize that way more than a few months have passed, but I'd still like
> to give my input. I really wish that `blist` would be made available in the
> `collections` module. I'm working on an open-source project right now that
> needs to use it and I'm really reluctant to include `blist` as a
> dependency, given that it would basically mean my package wouldn't be
> pip-installable on Windows machines.
Does it need to be a dependency though? You could make it optional.
Assuming that blist has the same API as a list, you could do:
try:
from blist import blist
except ImportError:
blist = list
which makes blist an optimization, if and when it is available.
--
Steven
More information about the Python-ideas
mailing list