Re: [Python-ideas] DOM syntax guide

2017-08-16 Thread Abdur-Rahmaan Janhangeer
Thanks all for links ! will look at them. i intend making that compiler as a fun project ^^ Abdur-Rahmaan Janhangeer, Mauritius abdurrahmaanjanhangeer.wordpress.com On 16 Aug 2017 08:41, "Abdur-Rahmaan Janhangeer" wrote: > greetings all, > > i like python and lot and

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 12:55 PM, Yury Selivanov [..] > And immediately after I hit "send" I realized that this is a bit more > complicated. > > In order for Tasks to remember the full execution context of where > they were created, we need a new method that would allow to run with > *both* exec

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 4:12 PM, Antoine Pitrou wrote: > > > Hi, > >> * ``sys.get_execution_context()`` function. The function returns a >> copy of the current EC: an ``ExecutionContext`` instance. > > Can you explain the requirement for it being a copy? When the execution

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Stefan Krah
On Wed, Aug 16, 2017 at 12:40:26PM -0400, Yury Selivanov wrote: > On Wed, Aug 16, 2017 at 12:08 PM, Stefan Krah wrote: > > On Wed, Aug 16, 2017 at 11:00:43AM -0400, Yury Selivanov wrote: > >> "Context" is an established term for what PEP 550 tries to accomplish. > >> It's

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 12:51 PM, Yury Selivanov wrote: > On Wed, Aug 16, 2017 at 5:36 AM, Nick Coghlan wrote: >> On 16 August 2017 at 17:18, Nathaniel Smith wrote: >> [Yury wrote] > [..] * If ``coro.cr_local_context`` is an

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 5:36 AM, Nick Coghlan wrote: > On 16 August 2017 at 17:18, Nathaniel Smith wrote: > [Yury wrote] [..] >>> * If ``coro.cr_local_context`` is an empty ``LocalContext`` object >>> that ``coro`` was created with, the interpreter will

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 12:08 PM, Stefan Krah wrote: > On Wed, Aug 16, 2017 at 11:00:43AM -0400, Yury Selivanov wrote: >> "Context" is an established term for what PEP 550 tries to accomplish. >> It's used in multiple languages and runtimes, and while researching >> this

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 3:18 AM, Nathaniel Smith wrote: > On Tue, Aug 15, 2017 at 4:55 PM, Yury Selivanov > wrote: >> Hi, >> >> Here's the PEP 550 version 2. > > Awesome! Thanks! [..] >> >> * **Local Context**, or LC, is a key/value mapping that stores

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Stefan Krah
On Thu, Aug 17, 2017 at 01:03:21AM +1000, Nick Coghlan wrote: > For "ContextItem" for example, we may actually be better off calling > it "ContextKey", and have the methods be "ck.get_value()" and > "ck.set_value()". That would get us closer to the POSIX TSS > terminology, and emphasises that the

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Stefan Krah
On Wed, Aug 16, 2017 at 11:00:43AM -0400, Yury Selivanov wrote: > "Context" is an established term for what PEP 550 tries to accomplish. > It's used in multiple languages and runtimes, and while researching > this topic I didn't see anybody confused with the concept on > StackOverflow/etc. For me

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 11:03 AM, Nick Coghlan wrote: > On 17 August 2017 at 00:25, Stefan Krah wrote: >> Perhaps it would be possible to name the data structures by their >> functionality. >> E.g. if ExecutionContext is a stack, use ExecutionStack? >>

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 4:07 AM, Nick Coghlan wrote: > TLDR: I really like this version, and the tweaks I suggest below are > just cosmetic. Thanks, Nick! > I figure if there are any major technical traps > lurking, you'll find them as you work through updating the reference

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nick Coghlan
On 17 August 2017 at 00:25, Stefan Krah wrote: > Perhaps it would be possible to name the data structures by their > functionality. > E.g. if ExecutionContext is a stack, use ExecutionStack? > > Or if the dynamic scope angle should be highlighted, perhaps ExecutionScope > or

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 10:25 AM, Stefan Krah wrote: > On Wed, Aug 16, 2017 at 12:18:23AM -0700, Nathaniel Smith wrote: >> > Here's the PEP 550 version 2. >> >> Awesome! >> >> Some of the changes from v1 to v2 might be a bit confusing -- in >> particular the thing where

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 2:53 AM, Jelle Zijlstra wrote: [..] >> >> The below is an example of how context items can be used:: >> >> my_context = sys.new_context_item(description='mylib.context') >> my_context.set('spam') > > > Minor suggestion: Could we allow

Re: [Python-ideas] DOM syntax guide

2017-08-16 Thread Wes Turner
On Wednesday, August 16, 2017, Wes Turner wrote: > > > On Wednesday, August 16, 2017, Chris Angelico > wrote: > >> On Wed, Aug 16, 2017 at 10:06 PM, Abdur-Rahmaan Janhangeer >>

Re: [Python-ideas] DOM syntax guide

2017-08-16 Thread Wes Turner
On Wednesday, August 16, 2017, Chris Angelico wrote: > On Wed, Aug 16, 2017 at 10:06 PM, Abdur-Rahmaan Janhangeer > > wrote: > > hum i'm saying that if i write a compiler for python based on the js > > language, is there any guideline as how

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Stefan Krah
On Wed, Aug 16, 2017 at 12:18:23AM -0700, Nathaniel Smith wrote: > > Here's the PEP 550 version 2. > > Awesome! > > Some of the changes from v1 to v2 might be a bit confusing -- in > particular the thing where ExecutionContext is now a stack of > LocalContext objects instead of just being a

Re: [Python-ideas] DOM syntax guide

2017-08-16 Thread Chris Angelico
On Wed, Aug 16, 2017 at 10:06 PM, Abdur-Rahmaan Janhangeer wrote: > hum i'm saying that if i write a compiler for python based on the js > language, is there any guideline as how to make the syntax more pythonic? You may want to look at prior art, including PyPyJS and

Re: [Python-ideas] DOM syntax guide

2017-08-16 Thread Abdur-Rahmaan Janhangeer
hum i'm saying that if i write a compiler for python based on the js language, is there any guideline as how to make the syntax more pythonic? Abdur-Rahmaan Janhangeer, Mauritius abdurrahmaanjanhangeer.wordpress.com On 16 Aug 2017 08:41, "Abdur-Rahmaan Janhangeer" wrote:

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nick Coghlan
On 16 August 2017 at 18:37, Nathaniel Smith wrote: > On Tue, Aug 15, 2017 at 11:53 PM, Jelle Zijlstra > wrote: >> Minor suggestion: Could we allow something like >> `sys.set_new_context_item(description='mylib.context', >> initial_value='spam')`? That

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nick Coghlan
On 16 August 2017 at 17:18, Nathaniel Smith wrote: [Yury wrote] >> For these purposes we add a set of new APIs (they will be used in >> later sections of this specification): >> >> * ``sys.new_local_context()``: create an empty ``LocalContext`` >> object. >> >> *

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Jelle Zijlstra
2017-08-16 10:37 GMT+02:00 Nathaniel Smith : > On Tue, Aug 15, 2017 at 11:53 PM, Jelle Zijlstra > wrote: > > Minor suggestion: Could we allow something like > > `sys.set_new_context_item(description='mylib.context', > > initial_value='spam')`? That would

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nathaniel Smith
On Tue, Aug 15, 2017 at 11:53 PM, Jelle Zijlstra wrote: > Minor suggestion: Could we allow something like > `sys.set_new_context_item(description='mylib.context', > initial_value='spam')`? That would make it easier for type checkers to infer > the type of a ContextItem,

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nick Coghlan
TLDR: I really like this version, and the tweaks I suggest below are just cosmetic. I figure if there are any major technical traps lurking, you'll find them as you work through updating the reference implementation. On 16 August 2017 at 09:55, Yury Selivanov wrote: >

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Nathaniel Smith
On Tue, Aug 15, 2017 at 4:55 PM, Yury Selivanov wrote: > Hi, > > Here's the PEP 550 version 2. Awesome! Some of the changes from v1 to v2 might be a bit confusing -- in particular the thing where ExecutionContext is now a stack of LocalContext objects instead of just

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Jelle Zijlstra
2017-08-16 1:55 GMT+02:00 Yury Selivanov : > Hi, > > Here's the PEP 550 version 2. Thanks to a very active and insightful > discussion here on Python-ideas, we've discovered a number of > problems with the first version of the PEP. This version is a complete > rewrite