[Python-Dev] Type of range object members (original) (raw)
Guido van Rossum guido at python.org
Wed Aug 16 19:23:43 CEST 2006
- Previous message: [Python-Dev] Type of range object members
- Next message: [Python-Dev] Type of range object members
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 tpflags, 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/)
- Previous message: [Python-Dev] Type of range object members
- Next message: [Python-Dev] Type of range object members
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]