variable declaration

Nick Coghlan ncoghlan at iinet.net.au
Tue Feb 8 05:45:01 EST 2005


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 :)

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.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list