Self-modifying Code
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu May 26 18:02:36 EDT 2005
Steven D'Aprano a écrit :
(snip)
> Having said that, here is a good example of self-modifying code:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68429
>
> The RingBuffer class dynamically modifies itself once it is full so that
> its behaviour changes.
>
This is nothing more than a pythonic implementation of the state
pattern. I would not call this "self-modifying code", since the code
itself is not modified.
More information about the Python-list
mailing list