/ msg = textwrap.dedent('''\
// IDLE's subprocess can't connect to %s:%d. This may be due \
// to your personal firewall configuration. It is safe to \
// allow this internal connection because no data is visible on \
// external ports.''' % address)
//
/
On 11/19/05, Steven Bethard [EMAIL PROTECTED] wrote:
You are missing an important point here: There are intentionally no line
breaks in this string; it must be a single line, or else showerror will
break it in funny ways. So converting it to a multi-line string would
break it, dedent or
Noam Raphael wrote:
I just wanted to add another use case: long messages. Consider those
lines from idlelib/run.py:133
msg = IDLE's subprocess can't connect to %s:%d. This may be due \
to your personal firewall configuration. It is safe to \
allow this
Greg Ewing [EMAIL PROTECTED] writes:
James Y Knight wrote:
ITYM you mean If only python were lisp. (macros, or even reader macros)
No, I mean it would be more satisfying if there
were a syntax for expressing multiline string
literals that didn't force it to be at the left
margin. The
On 11/14/05, M.-A. Lemburg [EMAIL PROTECTED] wrote:
We have to draw a line somewhere - otherwise you could
just as well add all functions that accept single
string arguments as methods to the basestring
sub-classes.
Please read my first post in this thread - I think there's more reason
for
Just two additional notes:
On 9/15/05, Raymond Hettinger [EMAIL PROTECTED] wrote:
-1
Let it continue to live in textwrap where the existing pure python code
adequately serves all string-like objects. It's not worth losing the
duck typing by attaching new methods to str, unicode,
Noam Raphael wrote:
That's a theoretical argument. In practice, if you do it in the
parser, you have two options:
1. Automatically dedent all strings.
2. Add a 'd' or some other letter before the string.
Option 1 breaks backwards compatibility, and makes the parser do
unexpected things.
On 11/14/05, Fredrik Lundh [EMAIL PROTECTED] wrote:
so is putting the string constant in a global variable, outside the scope
you're in, like you'd do with any other constant.
Usually when I use a constant a single time, I write it where I use
it, and don't give it a name. I don't do:
messagea
Noam Raphael wrote:
There's no reason why multilined strings that are used only once
should be defined at the beginning of a program (think about a simple
CGI script, which prints HTML parts in a function.)
I find that simple CGI scripts are precisely the example *for* putting
multi-line
James Y Knight wrote:
ITYM you mean If only python were lisp. (macros, or even reader macros)
No, I mean it would be more satisfying if there
were a syntax for expressing multiline string
literals that didn't force it to be at the left
margin. The lack of such in such an otherwise
Raymond Hettinger wrote:
That is somewhat misleading. We already have that ability. What is
being proposed is moving existing code to a different namespace. So the
motivation is really something like:
I want to write
s = s.dedent()
because it is too painful to write
Noam Raphael wrote:
Following Avi's suggestion, can I raise this thread up again? I think
that Reinhold's .dedent() method can be a good idea after all.
The idea is to add a method called dedent to strings. It would do
exactly what the current textwrap.indent function does.
You are missing
You are missing a point here: string methods were introduced
to make switching from plain 8-bit strings to Unicode easier.
Is it the only purpose ?
I agree with the OP that using string methods is much nicer and more
convenient than having to import separate modules.
Especially, it is nice to
Noam Raphael wrote:
Sorry, I didn't mean to mislead. I wrote easily - I guess using the
current textwrap.dedent isn't really hard, but still, writing:
import textwrap
...
r = some_func(textwrap.dedent('''\
line1
Hi,
some time ago, I proposed a string method dedent (which currently is in the
textwrap module). The RFE is at http://python.org/sf/1237680.
Any opinions? If I don't get positive comments, I'll reject it.
Reinhold
--
Mail address is perfectly valid!
some time ago, I proposed a string method dedent (which currently is
in
the
textwrap module). The RFE is at http://python.org/sf/1237680.
Any opinions? If I don't get positive comments, I'll reject it.
-1
Let it continue to live in textwrap where the existing pure python code
adequately
Okay. I consider it rejected.
Reinhold
Guido van Rossum wrote:
From the sound of it, it's probably not worth endowing every string
object with this method and hardcoding its implementation forever in C
code. There are so many corner cases and variations on the
functionality of dedenting a
17 matches
Mail list logo