Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Steven D'Aprano
On Sun, Apr 01, 2018 at 02:20:16AM +0100, Rob Cliffe via Python-ideas wrote: > >New unordered 'd' and 'D' prefixes, for 'dedent', applied to multiline > >strings only, would multiply the number of alternatives by about 5 and > >would require another rewrite of all code (Python or not) that parse

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Rob Cliffe via Python-ideas
In 3.6, we introduced a new prefix, 'f', so there was no back compatibility issue.  There was, however, a combinatorial explosion issue, as 'F' was also added (a mistake, I now think), and no order requirement (possibly another mistake).  Hence stringprefix    ::=  "r" | "u" | "R" | "U" g

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Steven D'Aprano
On Sat, Mar 31, 2018 at 06:58:19PM +0200, Jeroen Demeyer wrote: > On 2018-03-31 18:09, Steven D'Aprano wrote: > >It seems like a huge amount of work > > What is a huge amount of work? Writing the PEP? Implementing the PEP? > Using the PEP? Adapting existing Python code to the PEP? Any or all of

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Steven D'Aprano
On Sat, Mar 31, 2018 at 04:50:03PM +0200, Marius Räsener wrote: [...] > What I have in mind is probably best described with an Example: > > print(""" > I am a > multiline > String. > """) > > the closing quote defines the "margin indentation" - so in this example all > lines woul

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Terry Reedy
On 3/31/2018 2:14 PM, Marius Räsener wrote: Oh, ok... yeah didn‘t think of that. Except I guess I‘d assume that so far multiline strings are either with textwrap or ‚don‘t care‘? Maybe? For docstrings, I don't care, as a docstring consumer like help() can reformat the docstring with indents a

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Jeroen Demeyer
On 2018-03-31 21:12, Terry Reedy wrote: I would be all for more of the builtins and stdlib being converted. Can't 3rd-party C code use ArgumentClinic? ArgumentClinic stores the signature as text. For default values, only a few specific classes are supported. I want to support arbitrary Python

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Terry Reedy
On 3/31/2018 12:09 PM, Steven D'Aprano wrote: On Sat, Mar 31, 2018 at 04:48:56PM +0200, Jeroen Demeyer wrote: I have prepared a PEP draft for unifying function/method classes. You can find it at https://github.com/jdemeyer/PEP-functions This has not officially been submitted as PEP yet, I want

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Terry Reedy
On 3/31/2018 10:50 AM, Marius Räsener wrote: What I have in mind is probably best described with an Example: print("""     I am a     multiline     String.     """) the closing quote defines the "margin indentation" - so in this example all lines would get reduces by their leading 4 space

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Marius Räsener
Oh, ok... yeah didn‘t think of that. Except I guess I‘d assume that so far multiline strings are either with textwrap or ‚don‘t care‘? Maybe? But sure, with that in mind it gets more tricky Todd schrieb am Sa. 31. März 2018 um 19:49: > It would radically change the meaning of every existing mul

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Todd
It would radically change the meaning of every existing multi-line string. That is an enormous backwards-compatibility break. It might work as a __future__ import, though. On Sat, Mar 31, 2018, 13:03 Marius Räsener wrote: > Hey David, > > hm, that's actually a nice way to solve this too I guess

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Marius Räsener
Hey David, hm, that's actually a nice way to solve this too I guess, besides the additional import and "string literal". but as I answered to robert before (did it wrong with who to answer, correct it just now so the mailing-list has the answer, too) was, that I don't have a string literal in min

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Marius Räsener
Hey Robert Not really, I don‘t think another string literal would be nice. Also, to correct your example, it would have to look something like: print(d“““ I am a Line “““) The Idea is to use the closing quotes to detect the indentation length so to speak... 2018-03-31 17:48 GMT+0

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Jeroen Demeyer
On 2018-03-31 18:09, Steven D'Aprano wrote: It seems like a huge amount of work What is a huge amount of work? Writing the PEP? Implementing the PEP? Using the PEP? Adapting existing Python code to the PEP? Why isn't the answer to provide a hook to support introspection? That is a lot eas

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread David Mertz
I can currently write: from textwrap import dedent as d print(d(""" I am A Line """)) It doesn't feel like these hypothetical d-strings are with new syntax. On Sat, Mar 31, 2018, 11:49 AM Robert Vanden Eynde wrote: > So yes, currently you just do : > > import textwrap > > print(textwra

Re: [Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Steven D'Aprano
On Sat, Mar 31, 2018 at 04:48:56PM +0200, Jeroen Demeyer wrote: > I have prepared a PEP draft for unifying function/method classes. You > can find it at > > https://github.com/jdemeyer/PEP-functions > > This has not officially been submitted as PEP yet, I want to hear your > comments first. It

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Robert Vanden Eynde
So yes, currently you just do : import textwrap print(textwrap.dedent(""" I am A Line """)) So you'd want a string litteral ? print(d""" I am A Line """) Le sam. 31 mars 2018 à 17:06, Ryan Gonzalez a écrit : > I have to admit, regardless of how practical this is, it would sur

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Ryan Gonzalez
I have to admit, regardless of how practical this is, it would surely get rid of a ton of textwrap.dedent calls all over the place... On March 31, 2018 9:50:43 AM Marius Räsener wrote: Hey List, this is my very first approach to suggest a Python improvement I'd think worth discussing. At so

[Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Marius Räsener
Hey List, this is my very first approach to suggest a Python improvement I'd think worth discussing. At some point, maybe with Dart 2.0 or a little earlier, Dart is now supporting multiline strings with "proper" identation (tried, but I can't find the according docs at the moment. probably due to

[Python-ideas] PEP draft: Unifying function/method classes

2018-03-31 Thread Jeroen Demeyer
I have prepared a PEP draft for unifying function/method classes. You can find it at https://github.com/jdemeyer/PEP-functions This has not officially been submitted as PEP yet, I want to hear your comments first. Thanks, Jeroen. ___ Python-ideas