Re: [Python-ideas] Generator syntax hooks?

2017-08-11 Thread Paul Moore
On 11 August 2017 at 05:49, Steven D'Aprano wrote: > On Thu, Aug 10, 2017 at 01:25:24PM -0700, Chris Barker wrote: >> On Thu, Aug 10, 2017 at 8:39 AM, Paul Moore wrote: >> >> >> > Also, there's a potential issue >> > here - consider >> > >> > [expr for var in even_numbers() if is_odd(var) wh

[Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Jason H
Before I done my firesuit, I'd like to say that I much prefer python and I rail on JS whenever I can. However these days it is quite common to be doing work in both Python and Javascript. Harmonizing the two would help JS developers pick up the language as well as people like me that are stuck w

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alex Walters
> -Original Message- > From: Python-ideas [mailto:python-ideas-bounces+tritium- > list=sdamon@python.org] On Behalf Of Jason H > Sent: Friday, August 11, 2017 10:58 AM > To: python-ideas@python.org > Subject: [Python-ideas] Towards harmony with JavaScript? > > Before I done my firesu

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 12:57 AM, Jason H wrote: > Before I done my firesuit, I'd like to say that I much prefer python and I > rail on JS whenever I can. However these days it is quite common to be doing > work in both Python and Javascript. Harmonizing the two would help JS > developers pick

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Jason H
Thank for all the feedback so far, even if it's not the most enthusiastic response to the ideas. One thing I missed, and I don't know how I could (total face-palm) is: 4. Other list methods: i.e. and specifically: [].push(item) vs [].append() > Sent: Friday, August 11, 2017 at 10:57 AM > From:

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 1:35 AM, Jason H wrote: > Thank for all the feedback so far, even if it's not the most enthusiastic > response to the ideas. > > One thing I missed, and I don't know how I could (total face-palm) is: > 4. Other list methods: i.e. and specifically: [].push(item) vs [].appen

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alberto Berti
> "Jason" == Jason H writes: Jason> While JS is strongly for web (Node.JS, Browsers) and Python has a weak Jason> showing (Tornado, Flask), Python is very popular on everything else on Jason> the backend where JS isn't and isn't likely to be. The I'm making Jason> point is

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 3:04 AM, Alberto Berti wrote: > For the goal of reducing the friction (the mind switching when working > with both the languages) I have created a tool ( > https://github.com/azazel75/metapensiero.pj ) which allows me to write > valid Python and translates this to nice JS w

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Brendan Barnwell
On 2017-08-11 07:57, Jason H wrote: Before I done my firesuit, I'd like to say that I much prefer python and I rail on JS whenever I can. However these days it is quite common to be doing work in both Python and Javascript. Harmonizing the two would help JS developers pick up the language as well

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alberto Berti
> "Chris" == Chris Angelico writes: Chris> On Sat, Aug 12, 2017 at 3:04 AM, Alberto Berti wrote: >> For the goal of reducing the friction (the mind switching when working >> with both the languages) I have created a tool ( >> https://github.com/azazel75/metapensiero.pj ) whi

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 5:13 AM, Alberto Berti wrote: > Chris> What do you do about all the places where the languages have > Chris> significantly different semantics? For instance, a Python integer > can > Chris> store more values than a Python float (which is broadly compatible >

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Joao S. O. Bueno
On 11 August 2017 at 16:19, Chris Angelico wrote: > On Sat, Aug 12, 2017 at 5:13 AM, Alberto Berti > wrote: > > Chris> What do you do about all the places where the languages have > > Chris> significantly different semantics? For instance, a Python > integer can > > Chris> store more

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 5:42 AM, Joao S. O. Bueno wrote: > > > Well,I hope you both had at least skimmed over "brython" - it started a > couple years ago > with somewhat the same "won't o full Python purpose" - but nowadays they > have a > very conformant implementation of Python3 that is transpi

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 5:47 AM, Chris Angelico wrote: > > Taking this off the list as it's no longer on topic. ... at least, I *thought* I was taking it off list. Between me and Gmail, some thoughts got crossed. Sorry! ChrisA ___ Python-ideas mailing

Re: [Python-ideas] Generator syntax hooks?

2017-08-11 Thread Chris Barker
[...] > result = [] > for x in sequence: > if condition: > result.append(expression) > else: > break > > which could be written > > [expression for x in sequence if condition break] > > It's what I thought too. Adding a `while` clause here just overly > complicates the under

Re: [Python-ideas] Generator syntax hooks?

2017-08-11 Thread Markus Meskanen
Though I still dop'nt think using "while" would really introduce that much confusion -- sure, it doesn't introduce a new loop, but, as someone pointed out earlier in this thread it really is only changing from a: "while do" to a "do while" construct -- so means pretty much the same thing. +1

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Barker
> > Taking this off the list as it's no longer on topic. > not totally -- I'm going to add my thoughts: 1) If you want a smoother transition between server-side Python and in-browser code, maybe you're better off using one of the "python in the browser" solutions -- there are at least a few viab

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alberto Berti
> "Chris" == Chris Angelico writes: Chris> Speaking as someone whose day job is teaching Python and Chris> JavaScript, I have some "I'm a good teacher" stickers laying somewhere, do you want me to send them to you so you can put them somewhere? Chris> I don't like the idea of

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 6:31 AM, Alberto Berti wrote: > It's not really so confusing, most code I wrote with it it's perfectly > understandable Python code. For me, one thing is the language, one other > thing are the libraries or the builtin classes it's usually shipped > with. > > The tool reads

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Carl Smith
Python is not a good fit for the browser, in part, because of the syntax. JavaScript has issues, but its syntax is better suited to creating GUIs in the browser. For example, in browsers everything revolves around a single threaded event loop, so you have a lot of callbacks and event handlers, whic

[Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
Hi, This is a new PEP to implement Execution Contexts in Python. The PEP is in-flight to python.org, and in the meanwhile can be read on GitHub: https://github.com/python/peps/blob/master/pep-0550.rst (it contains a few diagrams and charts, so please read it there.) Thank you! Yury PEP: 550

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Antoine Rozo
Hi, Is a new EC type really needed? Cannot this be done with collections.ChainMap? 2017-08-12 0:37 GMT+02:00 Yury Selivanov : > Hi, > > This is a new PEP to implement Execution Contexts in Python. > > The PEP is in-flight to python.org, and in the meanwhile can > be read on GitHub: > > https://g

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alberto Berti
> "Carl" == Carl Smith writes: Carl> Python is not a good fit for the browser, in part, because of the syntax. Carl> JavaScript has issues, but its syntax is better suited to creating GUIs in Carl> the browser. Just so? Carl> For example, in browsers everything revolves ar

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
[duplicating my reply cc-ing python-ideas] > Is a new EC type really needed? Cannot this be done with collections.ChainMap? No, not really. ChainMap will have O(N) lookup performance where N is the number of contexts you have in the chain. This will degrade performance of lookups, which isn't acc

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Carl Smith
Using lambdas doesn't solve the problem. I just kept the example short, but had I used more than one expression in each function, you'd be back to square one. You took advantage of the brevity of the example, but it's not realistic. There are lots of language specific features that library authors

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Chris Angelico
On Sat, Aug 12, 2017 at 10:15 AM, Carl Smith wrote: > Using lambdas doesn't solve the problem. I just kept the example short, but > had I used more than one expression in each function, you'd be back to > square one. You took advantage of the brevity of the example, but it's not > realistic. > > T

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Alberto Berti
> "Carl" == Carl Smith writes: Carl> Using lambdas doesn't solve the problem. I just kept the example short, but Carl> had I used more than one expression in each function, you'd be back to Carl> square one. You took advantage of the brevity of the example, but it's not Carl

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Steven D'Aprano
Hi Jason, and welcome! On Fri, Aug 11, 2017 at 04:57:46PM +0200, Jason H wrote: > Before I done my firesuit, I'd like to say that I much prefer python > and I rail on JS whenever I can. However these days it is quite common > to be doing work in both Python and Javascript. Harmonizing the two

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Jelle Zijlstra
This is exciting and I'm happy that you're addressing this problem. We've solved a similar problem in our asynchronous programming framework, asynq. Our solution (implemented at https://github.com/quora/asynq/blob/master/asynq/contexts.py) is similar to that in PEP 521: we enhance the context mana

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
> This is exciting and I'm happy that you're addressing this problem. Thank you! > Some of our use cases can't be implemented using this PEP; notably, we use a > timing context that times how long an asynchronous function takes by > repeatedly pausing and resuming the timer. Measuring performa

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Eric Snow
On Aug 11, 2017 16:38, "Yury Selivanov" wrote: Hi, This is a new PEP to implement Execution Contexts in Python. Nice! I've had something like this on the back burner for a while as it helps solve some problems with encapsulating the import state (e.g. PEP 408). -eric

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Guido van Rossum
I may have missed this (I've just skimmed the doc), but what's the rationale for making the EC an *immutable* mapping? It's impressive that you managed to create a faster immutable dict, but why does the use case need one? -- --Guido van Rossum (python.org/~guido)

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Nathaniel Smith
On Fri, Aug 11, 2017 at 10:17 PM, Guido van Rossum wrote: > I may have missed this (I've just skimmed the doc), but what's the rationale > for making the EC an *immutable* mapping? It's impressive that you managed > to create a faster immutable dict, but why does the use case need one? In this pr

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
[replying to the list] > I may have missed this (I've just skimmed the doc), but what's the rationale > for making the EC an *immutable* mapping? It's possible to implement Execution Context with a mutable mapping and copy-on-write (as it's done in .NET) This is one of the approaches that I trie

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
> On Fri, Aug 11, 2017 at 10:17 PM, Guido van Rossum wrote: > > I may have missed this (I've just skimmed the doc), but what's the rationale > > for making the EC an *immutable* mapping? It's impressive that you managed > > to create a faster immutable dict, but why does the use case need one? >

Re: [Python-ideas] New PEP 550: Execution Context

2017-08-11 Thread Yury Selivanov
Thanks Eric! PEP 408 -- Standard library __preview__ package? Yury ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/