loose methods : Smalltalk asPython

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Dec 27 06:26:59 EST 2006


Steven D'Aprano:
> You can't modify the built-in classes. I'm not sure that it is a good idea
> to allow built-ins to be modified. When I see an int, I like the fact that
> I know what the int can do, and I don't have to worry about whether it has
> been modified by some piece of code elsewhere.

I think it can be useful, there are many situations where you may need
to change the behavior  of built-in dicts, etc, but:
- You need to keep code sorted and tidy to avoid problems. (This is
true for most of Python code too today. For example ObjectPascal gives
you less freedom to shoot yourself in the foot.)
- Allowing the built-in objects to be dynamically modified like that
may slow down the virtual machine some, if you don't design it quite
carefully. Psyco can help here too.

Bye,
bearophile




More information about the Python-list mailing list