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

2018-04-01 Thread Marius Räsener
Ok I see this is nothing for any 3.x release. I imagine this now either ‚clean‘ for users with compatibility break or just leave things as they are. So, if at all, maybe something for Python 4 :) Coincidence I watched yesterday Armin Ronachers talk related to seeing compatibility as the holy cow -

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

2018-04-01 Thread Steven D'Aprano
On Sun, Apr 01, 2018 at 07:39:31AM +, Marius Räsener wrote: > Ok I see this is nothing for any 3.x release. [...] > So, if at all, maybe something for Python 4 :) No, that's the wrong conclusion to draw. There are four options: (1) Change the behaviour of triple-quoted strings, immediately a

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

2018-04-01 Thread Nick Coghlan
On 1 April 2018 at 02:58, Jeroen Demeyer wrote: > On 2018-03-31 18:09, Steven D'Aprano wrote: >> Seems to me that if you want a fast, exact (no subclasses) check, you >> should use "type(obj) is Class" rather than isinstance. If the *only* >> reason to prohibit subclassing is to make isinstance a

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

2018-04-01 Thread Eric V. Smith
On 3/31/2018 9:48 PM, Steven D'Aprano wrote: 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 o

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

2018-04-01 Thread Chris Angelico
On Sun, Apr 1, 2018 at 7:11 PM, Eric V. Smith wrote: > Interestingly, in 2.7 'ur' is a valid prefix, but not in 3.6. I don't recall > if that was deliberate or not. And 'ru' isn't valid in either version. I believe it was. The 'ur' string literal in Py2 was a bizarre hybrid of raw-but-allowing-Un

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

2018-04-01 Thread Nick Coghlan
On 1 April 2018 at 19:24, Chris Angelico wrote: > Since the entire point of the Py3 u"..." prefix is compatibility with > Py2, the semantics have to be retained. There's no point supporting > ur"..." in Py3 if it's not going to produce the same result as in Py2. Right, "ur" strings were originall

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

2018-04-01 Thread Michel Desmoulin
A "d" prefix to do textwrap.dedent is something I wished for a long time. It's like the "f" one: we already can do it, be hell is it convenient to have a shortcut. This is especially if, like me, you take a lot of care in the error messages you give to the user. I write a LOT of them, very long,

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

2018-04-01 Thread Richard Damon
On 4/1/18 5:11 AM, Eric V. Smith wrote: > On 3/31/2018 9:48 PM, Steven D'Aprano wrote: >> 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 al

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

2018-04-01 Thread francismb
Hi, On 03/31/2018 09:47 PM, Terry Reedy wrote: > With no padding, I would not argue with someone who prefers > textwrap.dedent, but dedent cannot add the leading space. Couldn't one use use the 'indent' method on the 'textwrap' module for that purpose? Thanks, --francis _

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

2018-04-01 Thread Steven D'Aprano
On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: > One comment about the 'combitorial explosion' is that it sort of assumes > that each individual combination case needs to be handled with distinct > code. No -- as I said in an earlier post, Terry and I (and Eric) are talking about

Re: [Python-ideas] Generalized version of contextlib.close

2018-04-01 Thread francismb
On 03/26/2018 10:35 AM, Roberto Martínez wrote: > Hi, > > sometimes I need to use contextlib.close but over methods with a different > name, for example stop(), halt(), etc. For those cases I have to write my > own contextlib.close specialized version with a hard-coded method name. > > I think

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

2018-04-01 Thread Chris Angelico
On Sun, Apr 1, 2018 at 10:36 PM, Steven D'Aprano wrote: > And that *mental complexity* is (in my opinion) the biggest issue with > adding a new d-prefix, and why I would rather make it a method. > > Another big advantage of a method is that we can apply it to > non-literals too. I'd like to expan

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

2018-04-01 Thread Eric V. Smith
On 4/1/2018 8:55 AM, Chris Angelico wrote: On Sun, Apr 1, 2018 at 10:36 PM, Steven D'Aprano wrote: And that *mental complexity* is (in my opinion) the biggest issue with adding a new d-prefix, and why I would rather make it a method. Another big advantage of a method is that we can apply it to

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

2018-04-01 Thread Terry Reedy
On 4/1/2018 8:36 AM, Steven D'Aprano wrote: On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: One comment about the 'combinatorial explosion' is that it sort of assumes that each individual combination case needs to be handled with distinct code. No -- as I said in an earlier po

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

2018-04-01 Thread Marius Räsener
Hey again, Thx all for the active discussion. Since I‘m the OP and though want to make clear that I didn‘t had a `d` string literal in mind. So the Idea was to support this just as default, with any more effords to support it I don‘t see a real advantage or that I‘d think it is ‚solved‘. So I‘m

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

2018-04-01 Thread Richard Damon
On 4/1/18 8:36 AM, Steven D'Aprano wrote: > On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: > >> One comment about the 'combitorial explosion' is that it sort of assumes >> that each individual combination case needs to be handled with distinct >> code. > No -- as I said in an earlie

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

2018-04-01 Thread Chris Angelico
On Mon, Apr 2, 2018 at 5:25 AM, Marius Räsener wrote: > Actually I‘d rather like to see Python develop backwards and remove string > literals and not getting even more ... so maybe just `r` and `b`? Yeah, that's not gonna happen :) ChrisA ___ Python-id

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

2018-04-01 Thread Brendan Barnwell
On 2018-04-01 05:36, Steven D'Aprano wrote: On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: One comment about the 'combitorial explosion' is that it sort of assumes that each individual combination case needs to be handled with distinct code. No -- as I said in an earlier post,

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

2018-04-01 Thread Richard Damon
On 4/1/18 4:31 PM, Brendan Barnwell wrote: > On 2018-04-01 05:36, Steven D'Aprano wrote: >> On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: >> >>> One comment about the 'combitorial explosion' is that it sort of >>> assumes >>> that each individual combination case needs to be handle

Re: [Python-ideas] Generalized version of contextlib.close

2018-04-01 Thread Giampaolo Rodola'
On Mon, Mar 26, 2018 at 10:35 AM, Roberto Martínez < robertomartin...@gmail.com> wrote: > Hi, > > sometimes I need to use contextlib.close but over methods with a different > name, for example stop(), halt(), etc. For those cases I have to write my > own contextlib.close specialized version with a

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

2018-04-01 Thread MRAB
On 2018-04-01 20:10, Terry Reedy wrote: On 4/1/2018 8:36 AM, Steven D'Aprano wrote: On Sun, Apr 01, 2018 at 08:08:41AM -0400, Richard Damon wrote: One comment about the 'combinatorial explosion' is that it sort of assumes that each individual combination case needs to be handled with distinct

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

2018-04-01 Thread Mike Miller
On 2018-04-01 05:36, Steven D'Aprano wrote: You are right that many of the prefixes can be handled by the same code: rfd rfD rFd rFD rdf rdF rDf rDF Rfd RfD RFd RFD Rdf RdF RDf RDF frd frD fRd fRD fdr fdR fDr fDR Frd FrD FRd FRD Fdr FdR FDr FDR drf drF dRf dRF dfr dfR d