Re: Invoking return through a function?

2017-10-31 Thread Alberto Riva
On 10/31/2017 11:01 AM, Rhodri James wrote: On 31/10/17 02:06, Alberto Riva wrote: Steve D'Aprano gave you a pretty full answer, I just wanted to add:  The kind of statement I was trying to add would at least have made that explicit: return-if-so-and-so-happens. That's only obvious

Re: Invoking return through a function?

2017-10-30 Thread Alberto Riva
On 10/30/2017 12:23 AM, Rustom Mody wrote: On Sunday, October 29, 2017 at 9:52:01 PM UTC+5:30, Rick Johnson wrote: On Sunday, October 29, 2017 at 9:19:03 AM UTC-5, Alberto Riva wrote: In a language like Lisp Python is nothing like Lisp, and for good reason! Sure, we have a few lispers

Re: Invoking return through a function?

2017-10-30 Thread Alberto Riva
On 10/30/2017 10:27 AM, Rhodri James wrote: On 29/10/17 16:45, Alberto Riva wrote: On 10/29/2017 11:13 AM, bartc wrote: (What the OP wants was also proposed a few weeks back in comp.lang.c. But that was only within nested functions, so if H is inside G, and G is inside F, then a 'returnall

Re: Invoking return through a function?

2017-10-29 Thread Alberto Riva
I was just asking for information. Thanks, Alberto On 10/29/2017 04:35 PM, Rick Johnson wrote: Alberto Riva wrote: Rick Johnson wrote: Alberto Riva wrote: Rick Johnson wrote: Alberto Riva wrote: [...] In a language like Lisp Python is nothing like Lisp, and for good reason! I woul

Re: Invoking return through a function?

2017-10-29 Thread Alberto Riva
On 10/29/2017 02:13 PM, Rick Johnson wrote: Alberto Riva wrote: Rick Johnson wrote: Alberto Riva wrote: [...] In a language like Lisp Python is nothing like Lisp, and for good reason! I would disagree with this. Actually, it's the most Lisp- like language I've encountered in my 25

Re: Invoking return through a function?

2017-10-29 Thread Alberto Riva
On 10/29/2017 12:21 PM, Rick Johnson wrote: On Sunday, October 29, 2017 at 9:19:03 AM UTC-5, Alberto Riva wrote: Hello, I'm wondering if there is a way of writing a function that causes a return from the function that called it. To explain with an example, let's say that I want to exit my

Re: Invoking return through a function?

2017-10-29 Thread Alberto Riva
On 10/29/2017 11:13 AM, bartc wrote: (What the OP wants was also proposed a few weeks back in comp.lang.c. But that was only within nested functions, so if H is inside G, and G is inside F, then a 'returnall' from H would return directly directly from F. Apparently Lisp allows this...)

Re: Invoking return through a function?

2017-10-29 Thread Alberto Riva
On 10/29/2017 10:35 AM, Steve D'Aprano wrote: On Mon, 30 Oct 2017 01:18 am, Alberto Riva wrote: Hello, I'm wondering if there is a way of writing a function that causes a return from the function that called it. To explain with an example, let's say that I want to exit my function if a dict

Invoking return through a function?

2017-10-29 Thread Alberto Riva
Hello, I'm wondering if there is a way of writing a function that causes a return from the function that called it. To explain with an example, let's say that I want to exit my function if a dict does not contain a given key. I could write: def testFun(): ... if key not in dict: