[Python-Dev] Type of range object members

Guido van Rossum guido at python.org
Wed Aug 16 19:23:43 CEST 2006


On 8/15/06, Neal Norwitz <nnorwitz at gmail.com> wrote:
> I was playing around with a little patch to avoid that penalty.  It
> doesn't take any additional memory, just a handful of bits we aren't
> using. :-)
>
> For the more common builtin types, it stores whether it's a subclass
> in tp_flags, so there's no function call necessary and it's a constant
> time operation.  It was faster when doing simple stuff.  Haven't
> thought much whether this is really worthwhile or not.

I like it! I wonder if you should use another bit for "inherits from
BaseException". That would make catching and raising exceptions a bit
faster. It applies cleanly to py3k -- perhaps you should just check it
in there? +1 from me!

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list