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 would like to use it every

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 an

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 context is used to s

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Antoine Pitrou
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? What do you call a copy exactly? Does it shallow-copy the stack or does it deep copy the context items?

Re: [Python-ideas] PEP 550 v2

2017-08-16 Thread Yury Selivanov
On Wed, Aug 16, 2017 at 1:13 PM, Stefan Krah wrote: > 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 55

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 used in multiple language

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 empty ``LocalContext`` object that ``coro`` was created

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 set >>> ``coro.cr_local_context``

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 topic I didn't see anybody

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 the >> context of a logical thread. > >

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 o

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? >> >> Or if the dynamic scope angle should be

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 > implementation. F

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 even DynamicScope. >

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 ExecutionContext is now a s

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 something like > `sys.set_new_c

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 >> wrote: >> > hum i'm saying that if i write a compiler for python based on the js >> > language, is there any guideline

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 to make the syntax more pythonic? > > You may want to l

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 mappi

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 Brython. https://github.com

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: > greetings all, > > i

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 would make it easier for type checkers to inf

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. >> >> * ``sys.new_execution_context()``:

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 make it easier for type checkers to > infe

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, and it would save a line of

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: > Context Item Object > --

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 being a mapping. So here's t