YA string interpolation and printing idea
michele.simionato at poste.it
Mon Jan 19 17:52:10 CET 2004
Christos "TZOTZIOY" Georgiou <tzot at sil-tec.gr> wrote in message news:<gk8n005kohqq4g39hul6huj7i0ta2f71fg at 4ax.com>...
> On 16 Jan 2004 20:52:08 -0800, rumours say that Paul Rubin
> <http://phr.cx@NOSPAM.invalid> might have written:
> >Maybe if type/object
> >unification proceeds far enough, we'll someday be able to define our
> >own operations on builtin objects like strings.
> I'd like that too, and I believe Ruby does it; however, ISTR that Guido
> has specifically said that this won't be allowed, since you can always
> subclass the base types. He's the boss :)
> I've also seen a hackish patch (by MWH? can't be sure) that allowed one
> to substitute their own classes for the base types (so that integer or
> string constants would be instances of the derived subclasses). Don't
> know if that would help you in your code.
In Python, you cannot change built-in types, but you can always derive
a new type with additional methods and give to the new type the name
of a built-in type. So, we don't miss much of Ruby functionality, we just
miss is a bit of sugar. Also, knowing that the builtins types are fixed,
gives me some sense of safety ...
More information about the Python-list