Re: [Python-ideas] if-statement in for-loop

2016-10-05 Thread Paul Moore
On 5 October 2016 at 05:09, Ken Kundert wrote: > On Wed, Oct 05, 2016 at 03:07:42AM +1100, Steven D'Aprano wrote: >> >> Extra newlines are cheap. Writing >> > > The cost is paid in newlines *and* extra levels of indentation. No extra indentation if you ise "if not

Re: [Python-ideas] if-statement in for-loop

2016-10-05 Thread Steven D'Aprano
On Tue, Oct 04, 2016 at 09:09:40PM -0700, Ken Kundert wrote: > On Wed, Oct 05, 2016 at 03:07:42AM +1100, Steven D'Aprano wrote: > > > > Extra newlines are cheap. Writing > > > > The cost is paid in newlines *and* extra levels of indentation. You've quoted me out of context -- I did also refer

Re: [Python-ideas] async objects

2016-10-05 Thread Greg Ewing
Paul Moore wrote: I don't know *that* much about Erlang, but Python's model is that of a single shared address space with (potentially multiple) threads of code running, having access to that address space. I don't know much about Erlang either, but from what I gather, it's a functional

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Sylvain Desodt
Hi all, A bit of shameless self-promotion but in case anyone interested, a while ago, I had started to work on a project to improve error message. In case anyone's interested, you can found everything at: https://github.com/SylvainDe/DidYouMean-Python . It can be invoked in different ways, one of

Re: [Python-ideas] async objects

2016-10-05 Thread Nick Coghlan
On 5 October 2016 at 16:49, Rene Nejsum wrote: >> On 04 Oct 2016, at 18:40, Sven R. Kunze wrote: >> I don't think that's actually what I wanted here. One simple keyword should >> have sufficed just like golang did. So, the developer gets a way to decide >>

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Lisa Roach
+1 I've definitely seen a lot of new users make this error, an improved message could go a long way. On Tue, Oct 4, 2016 at 1:52 PM, Nathan Goldbaum wrote: > Hi all, > > Recently pypy received a patch that improves the error message one gets > when 'self' is missing in a

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Stephan Houben
+∞ Another long-time user here who occasionally still makes this mistake. Stephan 2016-10-05 19:29 GMT+02:00 Paul Moore : > On 5 October 2016 at 18:17, Lisa Roach wrote: > > +1 > > > > I've definitely seen a lot of new users make this error, an

Re: [Python-ideas] if-statement in for-loop

2016-10-05 Thread Paul Moore
On 5 October 2016 at 17:26, Nick Coghlan wrote: > Compared to those, locally modifying the token stream to inject ": > INDENT" pairs when the if and for keywords are encountered between an > opening "for" keyword and a closing ":" keyword would be a relatively >

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Paul Moore
On 5 October 2016 at 18:17, Lisa Roach wrote: > +1 > > I've definitely seen a lot of new users make this error, an improved message > could go a long way. I'm not a new user by any means, and I still regularly make this mistake. Because I've got the experience, I recognise

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Chris Angelico
On Thu, Oct 6, 2016 at 5:27 AM, Michel Desmoulin wrote: > +1. Python does need better error messages. This and the recent new import > exception will really help. > > Will feature freeze prevent this to get into 3.6 if some champion it? > Given that it's not changing

Re: [Python-ideas] async objects

2016-10-05 Thread Michel Desmoulin
On the other hand, await / async is a fantastic interface to unify all concurrent paradigms and asyncio already provide a bridge with threads and subprocess. So it kinda make sense. Le 04/10/2016 à 18:40, Sven R. Kunze a écrit : On 04.10.2016 13:30, Nick Coghlan wrote: What it *doesn't* do,

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread Ivan Levkivskyi
On 5 October 2016 at 20:55, Yury Selivanov wrote: > > Speaking of, I'm not much of a C hacker, and messing with CPython internals >> is a little daunting. If anyone wants to take this on, you have my >> blessing. I also may take a shot at implementing this idea in the

Re: [Python-ideas] async objects

2016-10-05 Thread Sven R. Kunze
On 05.10.2016 20:23, Michel Desmoulin wrote: On the other hand, await / async is a fantastic interface to unify all concurrent paradigms and asyncio already provide a bridge with threads and subprocess. So it kinda make sense. Almost if it would not require duplicate pieces of code. But

Re: [Python-ideas] xfork [was Re: async objects]

2016-10-05 Thread Sven R. Kunze
On 05.10.2016 06:11, Ethan Furman wrote: On 10/04/2016 09:40 AM, Sven R. Kunze wrote: As a result of past discussions, I wrote the module "xfork" which basically does this "golang goroutine" stuff. It's just a thin wrapper around "futures" but it allows to avoid that what René and Anthony

Re: [Python-ideas] Improve error message when missing 'self' in method definition

2016-10-05 Thread אלעזר
Isn't it possible to implement it as a pure Python exception hook? On Wed, Oct 5, 2016 at 10:04 PM Ivan Levkivskyi wrote: > > On 5 October 2016 at 20:55, Yury Selivanov > wrote: > > > Speaking of, I'm not much of a C hacker, and messing with

Re: [Python-ideas] async objects

2016-10-05 Thread Sven R. Kunze
On 05.10.2016 08:49, Rene Nejsum wrote: As a result of past discussions, I wrote the module "xfork" which basically does this "golang goroutine" stuff. It's just a thin wrapper around "futures" but it allows to avoid that what René and Anthony objects about. I had a look at xfork, and

Re: [Python-ideas] async objects

2016-10-05 Thread Ethan Furman
On 10/05/2016 12:20 PM, Sven R. Kunze wrote: On 05.10.2016 18:06, Nick Coghlan wrote: Guido's idea of a shadow thread to let synchronous threads run coroutines without needing to actually run a foreground event loop should provide a manageable way of getting the two runtime models

Re: [Python-ideas] async objects

2016-10-05 Thread Rene Nejsum
> On 05 Oct 2016, at 21:20, Sven R. Kunze wrote: > > On 05.10.2016 18:06, Nick Coghlan wrote: >> [runtime matters] > > I think I understand your point. > > I also hope that others and me could provide you with our perspective. We see > Python not as a C-like runtime but as

Re: [Python-ideas] async objects

2016-10-05 Thread Paul Moore
On 5 October 2016 at 21:28, Rene Nejsum wrote: > But, are the runtimes for Python and Erlang that fundamentally different? Is > it Python’s tight integration with C that is the big difference? I don't know *that* much about Erlang, but Python's model is that of a single