Suggestion for a "data" object syntax

Chris Angelico rosuav at gmail.com
Fri May 11 03:15:26 EDT 2018


On Fri, May 11, 2018 at 4:39 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Mon, May 7, 2018 at 9:45 PM, Mikhail V <mikhailwas at gmail.com> wrote:
>> Benefits are easy to see: say I want a tuple of strings:
>>
>> data === T :
>>     "foo bar"
>>     "hello world"
>>     "to be continued..."
>>
>> VS current:
>>
>> data = (
>>     "foo bar" ,
>>     "hello world" ,
>>     "to be continued..." ,
>>     )
>>
>> Main problem with the latter are commas, it is not easy
>> to type
>
> In what bizarro world are commas harder to type than tabs? At least if
> I type a comma I know I'll get a comma. If I type a tab then it
> depends on my editor settings what I'll actually get.

In Mikhail's defense, this is a reasonably elegant solution to the
age-old problem of "I forgot a comma, now two of my entries got joined
implicitly". It automatically makes multiple entries, and if you WANT
joined entries, you would have to request that explicitly with the +
operator or a line continuation backslash. Oh wait, these things
aren't actual expressions, so you probably can't do either of those
things... hmm.

ChrisA



More information about the Python-list mailing list