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

2018-04-02 Thread Nick Coghlan
On 26 March 2018 at 18:35, Roberto Martínez wrote: > @contextmanager > def calling(fn, *args, **kwargs): > try: > yield > finally: > fn(*args, **kwargs) I'd be more amenable to a proposal along these lines (rather than adding a parameter to closing), as it more closely res

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

2018-04-02 Thread Michel Desmoulin
Le 02/04/2018 à 07:09, Mike Miller a écrit : > > 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 >>   

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

2018-04-02 Thread INADA Naoki
Thanks for writing such hard PEP. At first glance, it new type hierarchy seems OK. But I can't understand rational for new flags. And it's very difficult to estimate runtime and maintenance cost of the PEP, without draft implementation. FASTCALL is introduced in recently version, and it make imp

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

2018-04-02 Thread Steve Barnes
On 01/04/2018 02:48, 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 ano

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

2018-04-02 Thread Steven D'Aprano
On Mon, Apr 02, 2018 at 12:08:47PM +, Steve Barnes wrote: > This would reflect that, typically, a specific developer tends to want > either all or no multi-line text strings dedented. I don't know how you come to that conclusion. I certainly would not want "All or Nothing" when it comes to

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

2018-04-02 Thread Nick Coghlan
On 2 April 2018 at 23:06, Steven D'Aprano wrote: > On Mon, Apr 02, 2018 at 12:08:47PM +, Steve Barnes wrote: > >> This would reflect that, typically, a specific developer tends to want >> either all or no multi-line text strings dedented. > > I don't know how you come to that conclusion. > > I

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

2018-04-02 Thread Jeroen Demeyer
On 2018-04-02 12:39, INADA Naoki wrote: Thanks for writing such hard PEP. At first glance, it new type hierarchy seems OK. But I can't understand rational for new flags. Which flags in particular do you mean? I just pushed an update explaining the rationale of METH_ARG0_FUNCTION: https://gi

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

2018-04-02 Thread INADA Naoki
On Tue, Apr 3, 2018 at 12:46 AM, Jeroen Demeyer wrote: > On 2018-04-02 12:39, INADA Naoki wrote: >> >> Thanks for writing such hard PEP. >> >> At first glance, it new type hierarchy seems OK. >> But I can't understand rational for new flags. > > > Which flags in particular do you mean? I just push

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

2018-04-02 Thread Serhiy Storchaka
31.03.18 17:48, 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. I once tried to move in this direction (

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

2018-04-02 Thread Guido van Rossum
I want to support this work. I can't promise your PEP will be accepted, but it looks like you've done your homework, and you're getting feedback from core devs who care about this area. (One of them may end up BDFL-delegate.) It will be a long road to success, but I recommend that you start with a

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

2018-04-02 Thread MRAB
On 2018-04-02 10:53, Michel Desmoulin wrote: Le 02/04/2018 à 07:09, Mike Miller a écrit : 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 fr

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Mike Miller
Yes, I first came across := when learning (Turbo) Pascal in the early 90's. However golang managed to screw it up—it only works there as a "short declaration AND assignment" operator. You can't use it twice on the same variable! Boggles the mind how experienced designers came up with that one

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

2018-04-02 Thread Mike Miller
On 2018-04-02 11:40, MRAB wrote: OTOH, it's not like it's causing a problem. Well, not a big one, but there are arguments for keeping a language as simple as possible. Also every time an idea comes up for a string prefix, the combinatorial issue comes up again.  If we could factor out an

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Guido van Rossum
IIRC Algol-68 (the lesser-known, more complicated version) used 'int x = 0;' to declare a constant and 'int x := 0;' to declare a variable. And there was a lot more to it; see https://en.wikipedia.org/wiki/ALGOL_68#mode:_Declarations. I'm guessing Go reversed this because they want '=' to be the co

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Mike Miller
Interesting, thanks. On 2018-04-02 15:03, Guido van Rossum wrote: ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/