String changing on the fly

Paul McGuire ptmcg at
Wed Oct 20 20:41:45 CEST 2004

"John Hunter" <jdhunter at> wrote in message
news:mailman.5235.1098294536.5135.python-list at
> >>>>> "John" == John Hunter <jdhunter at> writes:
> Continuing the fun, you can define a new python class that inherits
> from string, but overrides the "convert me to a string representation"
> method __str__ to evaluate itself in the context of the global
> variables
> import re
> class PerlString(str):


How do you know the language was Perl?  Could be Tcl, which also uses the
'$' substitution form. (Although "T=100" would be written "set T 100" in
that case.)

-- Paul

More information about the Python-list mailing list