Hrvoje Niksic a écrit :
> "Chris Mellon" <[EMAIL PROTECTED]> writes:
>
>
>>I have no idea why someone who already has a working, object system
>>would want to implement their own on top of closures.
>
>
> This subthread is getting ridiculous -- closures are *not* useful only
> for implementing
On 2007-11-01, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> Duncan Booth <[EMAIL PROTECTED]> writes:
>
>> In real life code methods are used to implement callbacks
>
> When I said "closures are used ...", I wasn't trying to be
> preachy about how I think callbacks should be implemented, just
> explai
On Oct 31, 5:59 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On Oct 31, 2007 5:49 PM, Dustan <[EMAIL PROTECTED]> wrote:
[snip]
I'm not going to respond to any of this, but I'm just going to say:
I'm not claiming that the use of closures is common. I'm just claiming
that it can be useful. I have
Duncan Booth <[EMAIL PROTECTED]> writes:
> In real life code methods are used to implement callbacks
When I said "closures are used ...", I wasn't trying to be preachy
about how I think callbacks should be implemented, just explaining the
use (and usefulness) of *closures*. I'm not saying closur
Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> In real-life code, closures are used to implement callbacks with
> automatic access to their lexical environment without the need for the
> bogus additional "void *" argument one so often sees in C callbacks,
> and without communication through global var
Hrvoje Niksic schrieb:
> "Chris Mellon" <[EMAIL PROTECTED]> writes:
>
>> I have no idea why someone who already has a working, object system
>> would want to implement their own on top of closures.
>
> This subthread is getting ridiculous -- closures are *not* useful only
> for implementing objec
"Chris Mellon" <[EMAIL PROTECTED]> writes:
> I have no idea why someone who already has a working, object system
> would want to implement their own on top of closures.
This subthread is getting ridiculous -- closures are *not* useful only
for implementing object systems! The object system thing
On Oct 31, 2007 5:49 PM, Dustan <[EMAIL PROTECTED]> wrote:
> On Oct 31, 7:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
> > Dustan <[EMAIL PROTECTED]> wrote:
> > > On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]>
> > > wrote:
> > >> Neil Cerutti <[EMAIL PROTECTED]> wrote:
> > >> > It's allo
On Oct 31, 7:08 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Dustan <[EMAIL PROTECTED]> wrote:
> > On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]>
> > wrote:
> >> Neil Cerutti <[EMAIL PROTECTED]> wrote:
> >> > It's allows a standard programming idiom which provides a
> >> > primitive form of
Dustan <[EMAIL PROTECTED]> wrote:
> On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]>
> wrote:
>> Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> > It's allows a standard programming idiom which provides a
>> > primitive form of object oriented programming using closures to
>> > represent state.
>>
On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]>
wrote:
> Neil Cerutti <[EMAIL PROTECTED]> wrote:
> > It's allows a standard programming idiom which provides a
> > primitive form of object oriented programming using closures to
> > represent state.
>
> > def account(opening_balance):
> > bal
brad a écrit :
> Tommy Nordgren wrote:
>
>>> def outer(avar=False):
>>> print avar
>>> if avar == True:
>>> return
>>>
>>> def inner(avar=True):
>>> print avar
>>> return avar
>>>
>>> outer(inner())
>>>
>>> outer()
>
>
>> This is not a general s
Neil Cerutti <[EMAIL PROTECTED]> wrote:
> It's allows a standard programming idiom which provides a
> primitive form of object oriented programming using closures to
> represent state.
>
> def account(opening_balance):
> balance = opening_balance
> def get_balance():
> nonlocal balance
>
Neil Cerutti wrote:
> On 2007-10-29, Steven Bethard <[EMAIL PROTECTED]> wrote:
>> Hrvoje Niksic wrote:
>>> Tommy Nordgren <[EMAIL PROTECTED]> writes:
>>>
Given the following:
def outer(arg)
avar = ''
def inner1(arg2)
# How can I set 'avar' here ?
>>> I d
On 2007-10-29, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Hrvoje Niksic wrote:
>> Tommy Nordgren <[EMAIL PROTECTED]> writes:
>>
>>> Given the following:
>>> def outer(arg)
>>> avar = ''
>>> def inner1(arg2)
>>> # How can I set 'avar' here ?
>>
>> I don't think you can, until
Hrvoje Niksic wrote:
> Tommy Nordgren <[EMAIL PROTECTED]> writes:
>
>> Given the following:
>> def outer(arg)
>> avar = ''
>> def inner1(arg2)
>> # How can I set 'avar' here ?
>
> I don't think you can, until Python 3:
> http://www.python.org/dev/peps/pep-3104/
But it definit
Tommy Nordgren wrote:
>> def outer(avar=False):
>> print avar
>> if avar == True:
>> return
>>
>> def inner(avar=True):
>> print avar
>> return avar
>>
>> outer(inner())
>>
>> outer()
> This is not a general solution to this problem.
Run my exam
Tommy Nordgren <[EMAIL PROTECTED]> writes:
> Given the following:
> def outer(arg)
> avar = ''
> def inner1(arg2)
> # How can I set 'avar' here ?
I don't think you can, until Python 3:
http://www.python.org/dev/peps/pep-3104/
Currently the (ugly) solution is to change variabl
"Tommy Nordgren" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Given the following:
| def outer(arg)
| avar = ''
| def inner1(arg2)
| # How can I set 'avar' here ?
You cannot at present. You can only mutate mutable outer vars:
def outer(arg):
avar = ['']
On 29 okt 2007, at 21.59, brad wrote:
> Tommy Nordgren wrote:
>> Given the following:
>> def outer(arg)
>> avar = ''
>> def inner1(arg2)
>> # How can I set 'avar' here ?
>
> Try this... works for me... maybe not for you?
>
> def outer(avar=False):
> print avar
> if a
Tommy Nordgren wrote:
> Given the following:
> def outer(arg)
> avar = ''
> def inner1(arg2)
> # How can I set 'avar' here ?
Try this... works for me... maybe not for you?
def outer(avar=False):
print avar
if avar == True:
return
def inner(avar=True):
Given the following:
def outer(arg)
avar = ''
def inner1(arg2)
# How can I set 'avar' here ?
-
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python
22 matches
Mail list logo