On Tue, Apr 24, 2012 at 2:42 PM, Seth Hetu <[email protected]> wrote:
> Huh, I never knew that Python included the newlines and spaces in
> multi-line strings (probably because I only use them for doc comments,
> which are post-formatted anyway).
>
> Hmm.... I can think of a few cases where it's useful to keep the
> spaces, and a few cases where it's useful to strip them. Would a
> function wrapper work with the current syntax? E.g.,
>
>         new textbox(remove_leading_ws("""
>               Buck Star:
>               Yes sensai Danielsan.""")
>                    , 4, align:center, align:bottom)
>

IMO it's simpler (from a user's POV) to support implicit string
compile-time string concatenation, than to have these stripping
operators.
For example,

        new textbox("Buck Star:\n"
                            "Yes sensai Danielsan", 4, align:center,
align:bottom)

This is also a property of Python. for example,

        >>> s = ("foo"
                      "bar")
        >>> s
        'foobar'

(hopefully the above shows up normally, rather than as a triple email
quotation :)


TL;DR : Docstring style is neat if you really need to write a many
lined string; if you just need a few lines, auto-concatenation is
easier and more predictable to work with.
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to