having both dynamic and static variables

John Nagle nagle at animats.com
Sat Mar 5 23:44:34 EST 2011


On 3/5/2011 7:46 PM, Corey Richardson wrote:
> On 03/05/2011 10:23 PM, MRAB wrote:
>> Having a fixed binding could be useful elsewhere, for example, with
>> function definitions:
>> [..]
>>       fixed PI = 3.1415926535897932384626433832795028841971693993751
>>
>>       fixed def squared(x):
>>           return x * x
>
> This question spawns from my ignorance: When would a functions
> definition change? What is the difference between a dynamic function and
> a fixed function?

    All functions in Python can be replaced dynamically. While they're
running. From another thread.  Really.

    Implementing this is either inefficient, with a lookup for every
use (CPython) or really, really complicated, involving just-in-time
compilers, invalidation, recompilation, and a backup interpreter
for when things get ugly (PyPy).

				John Nagle




More information about the Python-list mailing list