Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread David Mertz
This is pretty easy to write without any syntax changes, just using a higher-order function `compose()` (possible implementation at foot). Again, I'll assume auto-currying like the map/filter versions of those functions in toolz, as Steven does: > result = (myfile.readlines() > -> map(s

Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread Steven D'Aprano
On Fri, Aug 18, 2017 at 11:47:40AM -0700, Chris Barker wrote: > >> # arrow transform (to avoid endless parentheses and try to be more > readable. > > > >> > > >> >> range(5) -> map(.x->x+2, _) -> list(_) > > >> >> [2,3,4,5,6] > > > > > > I like the idea of chained function calls > > > parent

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Guido van Rossum
I'm also confused by these, because they share the noun part of their name, but their use and meaning is quite different. The PEP defines an EC as a stack of LCs, and (apart from strings :-) it's usually not a good idea to use the same term for a container and its items. On Fri, Aug 18, 2017 at 6:

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Ethan Furman
On 08/16/2017 08:43 AM, Yury Selivanov wrote: To be honest, I really like Execution Context and Local Context names. I'm curious if other people are confused with them. +1 confused :/ -- ~Ethan~ ___ Python-ideas mailing list Python-ideas@python.or

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Ethan Furman
On 08/17/2017 02:40 AM, Nick Coghlan wrote: On 17 August 2017 at 04:38, Yury Selivanov wrote: ck.get_value() attempts to look up the value for that key in the currently active execution context. If it doesn't find one, it then tries each of the execution contexts in the currently act

Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Wes Turner
PyContracts supports things like numpy array constraints https://andreacensi.github.io/contracts/reference.html#contracts-language-reference > You can specify that the value must be a list, and specify optional constraints for its length and for its elements. ... You mentioned JSONschema. For RD

Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Guido van Rossum
A similar approach (though only for class/instance variables) is taken by the 'attrs' package and by the proposal currently code-named "dataclasses" ( https://github.com/ericvsmith/dataclasses). On Fri, Aug 18, 2017 at 10:48 AM, Ivan Levkivskyi wrote: > Hi Bagrat, > > Thanks for a detailed propo

Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread Chris Barker
>> # arrow transform (to avoid endless parentheses and try to be more readable. > >> > >> >> range(5) -> map(.x->x+2, _) -> list(_) > >> >> [2,3,4,5,6] > > > > I like the idea of chained function calls parentheses aren't that bad, and as far as I can tell, this is just another way to call a

Re: [Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Ivan Levkivskyi
Hi Bagrat, Thanks for a detailed proposal! Indeed, some projects might want to have some additional metadata attached to a variable/argument besides its type. However, I think it would be more productive to first discuss this on a more specialized forum like https://github.com/python/typing/issues

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Yury Selivanov
On Fri, Aug 18, 2017 at 1:09 AM, Nick Coghlan wrote: > On 17 August 2017 at 01:22, Yury Selivanov wrote: >> On Wed, Aug 16, 2017 at 4:07 AM, Nick Coghlan wrote: Coroutine Object Modifications ^^ To achieve this, a small set of modifications to the

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Yury Selivanov
On Fri, Aug 18, 2017 at 2:12 AM, Stefan Behnel wrote: > Nathaniel Smith schrieb am 16.08.2017 um 09:18: >> On Tue, Aug 15, 2017 at 4:55 PM, Yury Selivanov wrote: >>> Here's the PEP 550 version 2. >> Awesome! > > +1 > >>> Backwards Compatibility >>> === >>> >>> This proposal pre

Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread Chris Angelico
On Fri, Aug 18, 2017 at 10:06 PM, Steven D'Aprano wrote: >> # arrow transform (to avoid endless parentheses and try to be more readable. >> >> >> range(5) -> map(.x->x+2, _) -> list(_) >> >> [2,3,4,5,6] > > I like the idea of chained function calls, like pipes in shell > languages such as bash

[Python-ideas] More Metadata for Variable Annotations

2017-08-18 Thread Bagrat Aznauryan
# Abstract Before the holly PEP-526 the only option for type hints were comments. And before PEP-484 the docstrings were the main place where variable metadata would go. That variable metadata would include: * the type * the human-readable description * some value constraints (e.g. a range for in

Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread MRAB
On 2017-08-18 13:06, Steven D'Aprano wrote: Hello Thautwarm, and welcome! [snip] # pattern matching use "condic" as keyword is for avoiding the # conflictions against the standard libraries and packages from third # party. "switch" and "match" both lead to conflictions. This is a hard probl

Re: [Python-ideas] How do you think about these language extensions?

2017-08-18 Thread Steven D'Aprano
Hello Thautwarm, and welcome! Sorry for the delay in responding, but this has been a very busy week for me personally, and an even busier week for my inbox, and so I missed your post until now. On Sun, Aug 13, 2017 at 12:49:45PM +, 王宣 ? wrote: > > Hi all, > > I've just finished a languag

Re: [Python-ideas] PEP 550 v2

2017-08-18 Thread Nick Coghlan
On 18 August 2017 at 16:12, Stefan Behnel wrote: > Nathaniel Smith schrieb am 16.08.2017 um 09:18: >> On Tue, Aug 15, 2017 at 4:55 PM, Yury Selivanov wrote: >>> Backwards Compatibility >>> === >>> >>> This proposal preserves 100% backwards compatibility. >> >> While this is mos