On 24 April 2012 22:45, Mike Caron <[email protected]> wrote:
> On Tue, Apr 24, 2012 at 4:41 AM, David Gowers (kampu) <[email protected]> 
> wrote:
>> 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)
>>>

Proper string literals are a future feature.

>>
>> 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.

But supporting literal concatenation (I might, though probably not
unlike the big lexer rewrite, due to problems with commas) is pretty
orthogonal. I think I agree that that looks better for only a few
lines. Textboxes could be quite long of course (I want to remove the
length limit and make them scrollable)

> That's not really a multiline string, though, that's just a bunch of
> strings glued together :)
>
> I believe it is overall more useful to include any whitespace
> wholesale. Yeah, it's ugly, but on the other hand, if you want those
> leading spaces to be included, well, now you have a way.

Well, you could still

> The only problem I can forsee with this is tabs versus spaces. Does
> the OHR handle tabs in any way? I don't recall...

It doesn't yet. Vague possibility that it may in future (but I think
more likely I'll just have the tab key auto indent). Had no reason to
add \t support in strings.

Hey, actually... we could just strip leading tabs from multiline
strings, since they don't do anything useful: they will just show up
as little arrow icons. However, the difference is invisible, and might
be modified by text editors, so kind of a bad idea. The alternative is
8 spaces per tab, I guess.

> --
> Mike Caron
> Tale of the Cave
> http://taleotc.com
> _______________________________________________
> Ohrrpgce mailing list
> [email protected]
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to