[Python-Dev] The Trick

Alex Martelli aleaxit at yahoo.com
Sat Oct 18 16:11:24 EDT 2003

On Saturday 18 October 2003 06:33 pm, Guido van Rossum wrote:
> I don't like the trick of avoiding the copy if the refcount is one;
> AFAIK it can't be done in Jython.

No, but if it's only a small optimization, who cares?  Anyway, the
objection that these functions might be called by _C_ code who's
holding the only reference to a PyObject* probably kills The Trick
(particularly my hope of moving it into PySequence_List whether
copysort survived or not).

> I think the application area is too narrow to warrant a built-in,
> *and* lists shouldn't grow two similar methods.  Let's keep the
> language small!

Aye aye, captain.

Can we dream of a standard library module of "neat hacks that
don't really warrant a built-in" in which to stash some of these
general-purpose, no-specific-appropriate-module, useful functions
and classes?  Pluses: would save some people reimplementing
them over and over and sometimes incorrectly; would remove
any pressure to add not-perfectly-appropriate builtins.  Minuses:
one more library module (the, what, 211th?  doesn't seem like
a biggie).  Language unchanged -- just library.  Pretty please?

> (I know, by that argument several built-ins shouldn't exist.  Well,
> they might be withdrawn in 3.0; let's not add more.)

"Amen and Hallelujah" to the hope of slimming language and
built-ins in 3.0 (presumably the removed built-ins will go into a
"legacy curiosa" module, allowing a "from legacy import *" to
ease making old code run in 3.0? seems cheap & sensible).


More information about the Python-Dev mailing list