Favorite non-python language trick?
Jp Calderone
exarkun at divmod.com
Sun Jul 3 17:21:41 EDT 2005
On Sun, 03 Jul 2005 15:40:38 -0500, Rocco Moretti <roccomoretti at hotpop.com> wrote:
>Jp Calderone wrote:
>> On Fri, 01 Jul 2005 15:02:10 -0500, Rocco Moretti
>> <roccomoretti at hotpop.com> wrote:
>>
>>>
>>> I'm not aware of a language that allows it, but recently I've found
>>> myself wanting the ability to transparently replace objects.
>>
>>
>> Smalltalk supports this with the "become" message. I have also done an
>> implementation of this for Python.
>
>As a pure Python module, or do you have to recompile the interpreter?
Somewhere in between, I guess. The module is all Python, but relies pretty heavily on one particular stdlib extension module.
The code is rather short, and online here:
http://divmod.org/users/exarkun/become.py
Jp
More information about the Python-list
mailing list