Summary: strong/weak typing and pointers

Steven Bethard steven.bethard at
Thu Nov 4 18:02:24 CET 2004

Diez B. Roggisch <deetsNOSPAM <at>> 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[0] = 65;
> The result is 
> "6bc"

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
> philosophies.

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[0] = 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 mailing list