Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 5.2.2012 3:31, John O'Hagan wrote: On Sat, 04 Feb 2012 02:27:56 +0200 Antti J Ylikoski wrote: [...] # Make a Common LISP-like closure with Python. # # Antti J Ylikoski 02-03-2012. def f1(): n = 0 def f2(): nonlocal n n += 1 return n return

Re: Common LISP-style closures with Python

2012-02-04 Thread John O'Hagan
On Sat, 04 Feb 2012 02:27:56 +0200 Antti J Ylikoski wrote: [...] > > # Make a Common LISP-like closure with Python. > # > # Antti J Ylikoski 02-03-2012. > > def f1(): > n = 0 > def f2(): > nonlocal n > n += 1 > return n > return f2 > [...] > > i.

Re: Common LISP-style closures with Python

2012-02-04 Thread Devin Jeanpierre
On Sat, Feb 4, 2012 at 5:58 AM, Arnaud Delobelle wrote: > I think what Chris asking is: what is the feature of Common-Lisp > closures that Python closures share but other languages don't? > > I think what he is implying is that there is no such feature.  Python > closures are no more "Common-Lisp-

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Chris Angelico
On Sun, Feb 5, 2012 at 3:32 AM, Andrew Berg wrote: > On 2/3/2012 9:15 PM, Chris Angelico wrote: >> Do you call on potentially-buggy external modules? > It imports one module that does little more than define a few simple > functions. There's certainly no (intentional) interpreter hackery at work.

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Andrew Berg
On 2/4/2012 11:06 AM, Steven D'Aprano wrote: > I suggest you raise an issue on the bug tracker. If you can't reproduce > the bug, it's unlikely to be fixed, but you might get lucky. Since I can't narrow it down to any specific circumstance or code, I'll gather information from a build of the inter

Re: Common LISP-style closures with Python

2012-02-04 Thread Tomasz Rola
On Sat, 4 Feb 2012, Antti J Ylikoski wrote: > On 4.2.2012 12:58, Arnaud Delobelle wrote: > > On 4 February 2012 10:14, Antti J Ylikoski wrote: > > > On 4.2.2012 4:47, Chris Rebert wrote: > > > > Out of curiosity, what would be non-Common-Lisp-style closures? > > > > > > > > Cheers, > > > > Chris

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Steven D'Aprano
On Sat, 04 Feb 2012 10:32:25 -0600, Andrew Berg wrote: > On 2/3/2012 5:25 PM, Steven D'Aprano wrote: >> Which version of Python, which version of Windows? > I keep that information in my signature for every post I make to this > list. CPython 3.2.2 | Windows NT 6.1.7601.17640 Why so you do. Did y

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Andrew Berg
On 2/3/2012 5:25 PM, Steven D'Aprano wrote: > Which version of Python, which version of Windows? I keep that information in my signature for every post I make to this list. CPython 3.2.2 | Windows NT 6.1.7601.17640 > If you upgrade Python, does the problem go away? I use the most recent stable ver

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 4.2.2012 12:58, Arnaud Delobelle wrote: On 4 February 2012 10:14, Antti J Ylikoski wrote: On 4.2.2012 4:47, Chris Rebert wrote: Out of curiosity, what would be non-Common-Lisp-style closures? Cheers, Chris I understand that a "closure" is something which is typical of functional program

Re: Common LISP-style closures with Python

2012-02-04 Thread Arnaud Delobelle
On 4 February 2012 10:14, Antti J Ylikoski wrote: > On 4.2.2012 4:47, Chris Rebert wrote: >> Out of curiosity, what would be non-Common-Lisp-style closures? >> >> Cheers, >> Chris > > > I understand that a "closure" is something which is typical of functional > programming languages.  -- Scheme-st

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 4.2.2012 12:14, Antti J Ylikoski wrote: On 4.2.2012 4:47, Chris Rebert wrote: On Fri, Feb 3, 2012 at 4:27 PM, Antti J Ylikoski wrote: In Python textbooks that I have read, it is usually not mentioned that we can very easily program Common LISP-style closures with Python. It is done as follo

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 4.2.2012 4:47, Chris Rebert wrote: On Fri, Feb 3, 2012 at 4:27 PM, Antti J Ylikoski wrote: In Python textbooks that I have read, it is usually not mentioned that we can very easily program Common LISP-style closures with Python. It is done as follows: -