variable declaration

Antoon Pardon apardon at forel.vub.ac.be
Tue Feb 8 06:50:01 EST 2005


Op 2005-02-08, Nick Coghlan schreef <ncoghlan at iinet.net.au>:
> Antoon Pardon wrote:
>> I have the impression you are looking at this too much from the view
>> of the current implementation where putting a an entry in
>> a directory is seen as an atomic operation.
>
> Yes and no. I *am* looking at it from an implementation point of view, but 
> dictionaries have nothing to do with the relevant part of the implementation.
>
> The CPython *_FAST opcodes relate to functions' local variables. Behind the 
> scenes they are implemented as integer indexing operations into a pre-sized C 
> array. Operations don't come much faster than that :)

I don't follow. AFAIR my remark here above was about the STORE opcode.
But you seem to react to it as if I am talking about STORE_FAST.

> Could a rebinding operation *theoretically* be quicker for the other cases which 
> involve a real dictionary (or something that looks like one)? Well, perhaps. 
> Although I can't see how the rebinding operation would gain a benefit that a 
> standard binding operation wouldn't gain if placed at the exact same point.

Well it probably wouldn't be quicker, but it wouldn't be slower either
as you asserted earlier.

-- 
Antoon Pardon



More information about the Python-list mailing list