Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017年5月29日 19:51:07 -0700

On Mon, May 29, 2017 at 07:27:05PM -0700, Guido van Rossum wrote:
> > https://www.corsix.org/content/why-are-slots-so-slow
> >
> 
> Is the author of that article using non-standard terminology? The article
> doesn't appear to be about __slots__ at all.
Quoting Armin Ronacher:
 By far my biggest problem with the language is the stupid slot
 system. I do not mean the __slots__ but the internal type slots
 for special methods.
http://lucumr.pocoo.org/2014/8/16/the-python-i-would-like-to-see/
Armin shows the history of these "slots" (or however they're called) 
back to Python in 1990!
static number_methods int_as_number = {
 intadd, /*tp_add*/
 intsub, /*tp_subtract*/
 intmul, /*tp_multiply*/
 ... etc
I don't know where the name "slot" comes for from the various tp_* 
members (fields? attributes? slots?) but I'm pretty sure I've heard it 
before. I don't normally pay attention to what happens in the C 
implementation, but I'm fairly sure he's referring to these tp_* 
thingies.
Oh yes, here you go:
https://docs.python.org/2/extending/newtypes.html#type-methods
refers to "tp_* slot" regularly. What does "tp" stand for? Type 
something, I guess.
-- 
Steve
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to