Implicit lists
Mel Wilson
mwilson at the-wire.com
Wed Feb 5 00:25:44 EST 2003
In article <7xisw1os5d.fsf at ruckus.brouhaha.com>,
Paul Rubin <phr-n2003b at NOSPAMnightsong.com> wrote:
>The whole string modulo thing is a wart and should be replaced with a
>sprintf function like every other language uses.
>
>The one operator overloading idea for strings that I like is a unary
>minus sign for interpolation:
>
> print -"foo is $foo"
>
>But that idea got no response at all last time I posted it.
The feature that made perl what it is today.
I'm not wild about commingling text and variable names.
It makes it awkward to say things like
-"The text control to edit the value of $foo is called $foo_ctrl."
C programs have to turn handsprings through hoops to get
this string splicing effect in their macros. And the given
example doesn't hint at any control of formatting, eg.
'%.3f'%foo .
I imagine we'd have to escape $ signs:
-"The input $foo must be less than $$100.00."
etc.
I like string modulo operations, myself. They're
succinct. They give a reasonable view of how the string is
structured and/vs. what gets inserted into it. They have a
strict definition so careful people can get what they want,
even if they also have a shaky alternate definition so
newbies and even-more-careful people can get what they want
some or all of the time.
Regards. Mel.
More information about the Python-list
mailing list