Summary: strong/weak typing and pointers
steven.bethard at gmail.com
Thu Nov 4 18:02:24 CET 2004
Diez B. Roggisch <deetsNOSPAM <at> web.de> writes:
> I'd second that - writing apus in php can lead to great surprises of what
> actually happens - take this for example:
> $foo = "abc";
> $foo = 65;
> The result is
If I learned nothing else from this thread, I learned that I *never* want to
screw around with PHP. ;)
> And don't forget: If you don't like the way someone overloaded some
> operator, you can alter that behaviour according to your own design
Python has the nice property that you're not allowed to modify builtins, so no
one can ever make your Python code do anything other than:
>>> foo = 'abc'
>>> foo = 65
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: object does not support item assignment
I wonder what people think about Ruby, which, I understand, does allow you to
modify builtins. Can anyone tell me if you could make Ruby strings do the
horrible coercion that PHP strings do?
More information about the Python-list