Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> Paul McGuire a écrit :
>> On May 19, 11:04 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>>> Paul McGuire <[EMAIL PROTECTED]> writes:
>>>
>>> [...]
>>>
>>> Could you use it as a decoratore instead?
>>>
>>> integer = Word("0123456789")
>>>
>>> @in
Paul McGuire a écrit :
On May 19, 11:04 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
Paul McGuire <[EMAIL PROTECTED]> writes:
[...]
Could you use it as a decoratore instead?
integer = Word("0123456789")
@integer.setParseAction
def parse_integer(tokens):
return int(tokens[0])
I could
Paul McGuire <[EMAIL PROTECTED]> writes:
> On May 19, 11:04 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>> Paul McGuire <[EMAIL PROTECTED]> writes:
>>
>> [...]
>>
>> Could you use it as a decoratore instead?
>>
>> integer = Word("0123456789")
>>
>> @integer.setParseAction
>> def parse_integer(
On May 19, 11:04 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> Paul McGuire <[EMAIL PROTECTED]> writes:
>
> [...]
>
> Could you use it as a decoratore instead?
>
> integer = Word("0123456789")
>
> @integer.setParseAction
> def parse_integer(tokens):
> return int(tokens[0])
>
> I could make
Paul McGuire <[EMAIL PROTECTED]> writes:
[...]
> lambda is handy in defining parse actions in pyparsing. Parse actions
> are callbacks to be run when an expression within a larger grammar is
> matched. A common use for parse actions is to do some sort of text or
> type conversion. The simplest
On May 18, 10:41 am, "inhahe" <[EMAIL PROTECTED]> wrote:
> > Both the responses offer lambda free alternatives. That's fine, and
> > given the terse documentation and problems that I had understanding
> > them, I would agree. So what applications are lambdas suited to? I
> > think the parameterised
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On May 19, 5:22 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
| > "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
| [...]
| > | Note that the same thing can be said about generator expressions,
| > | which are
inhahe a écrit :
Both the responses offer lambda free alternatives. That's fine, and
given the terse documentation and problems that I had understanding
them, I would agree. So what applications are lambdas suited to? I
think the parameterised function model is one.
What else?
i've hardly ever
On May 19, 5:22 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
[...]
> | Note that the same thing can be said about generator expressions,
> | which are nothing more than anonymous, non-reusable, generator
> | functions.
>
> Right. So if some
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Lie <[EMAIL PROTECTED]> writes:
|
| > Lambda can actually be safely removed from python and no other
| > features would be missing. It is always possible to create a def
| > version of any lambda, so lambda is useles
>
> Both the responses offer lambda free alternatives. That's fine, and
> given the terse documentation and problems that I had understanding
> them, I would agree. So what applications are lambdas suited to? I
> think the parameterised function model is one.
> What else?
i've hardly ever used lam
Lie <[EMAIL PROTECTED]> writes:
> Lambda can actually be safely removed from python and no other
> features would be missing. It is always possible to create a def
> version of any lambda, so lambda is useless. It is just a convenience
> for the times where we're just too lazy to invent a name and
On May 9, 12:12 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Thu, 08 May 2008 22:57:03 -0300,
> <[EMAIL PROTECTED]> escribió:
>
>
>
> > On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
> >> No, no, no, no, no!
> > Geez. Go easy.
> >> You have got it entirely wrong here. Yo
On May 9, 8:57 am, [EMAIL PROTECTED] wrote:
> On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
>
>
> > No, no, no, no, no!
>
> Geez. Go easy.
>
>
>
> > You have got it entirely wrong here. Your XOR function simply returns a
> > function which gives you the result of xoring the paramete
[EMAIL PROTECTED] wrote:
> Indeed, there are many ways this could be done. Some are more
> concise, some are more efficient. As I said, I did it the way I did
> it to try out lambdas. Your way achieves the result, rather elegantly
> I think, but teaches me nothing about using lambdas.
Unfortun
En Thu, 08 May 2008 22:57:03 -0300,
<[EMAIL PROTECTED]> escribió:
On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
No, no, no, no, no!
Geez. Go easy.
You have got it entirely wrong here. Your XOR function simply
[...]
Pardon my tetchiness, but it is a little hard to receive su
On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
> No, no, no, no, no!
>
Geez. Go easy.
> You have got it entirely wrong here. Your XOR function simply returns a
> function which gives you the result of xoring the parameters AT THE TIME
> WHEN YOU ORIGINALLY CREATED IT. I'm guessing
[EMAIL PROTECTED] wrote:
> Here is a simple lambda that implements an exclusive or:
>
def XOR(x,y) :
return lambda : ( ( x ) and not ( y ) ) or ( not ( x ) and ( y )
)
>
> (Because of the resemblance to C macros, I have been cautious and
> written the lambda with lots of parentheses
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On May 8, 7:38 am, globalrev <[EMAIL PROTECTED]> wrote:
| I would describe a lambda as a parameterised function template. If you
| dig, the docs call lambdas anonymous functions not bound to a name.
A lambda expression is an abbrevia
On May 8, 10:34 am, [EMAIL PROTECTED] wrote:
>
> >>> HeightDistrib = (170, 20)
>
That should be
> >>> HeightDistrib = Gaussian(170, 20)
--
http://mail.python.org/mailman/listinfo/python-list
On May 8, 7:38 am, globalrev <[EMAIL PROTECTED]> wrote:
> i have a rough understanding of lambda but so far only have found use
> for it once(in tkinter when passing lambda as an argument i could
> circumvent some tricky stuff).
> what is the point of the following function?
>
> def addn(n):
>
En Wed, 07 May 2008 18:38:15 -0300, globalrev <[EMAIL PROTECTED]>
escribió:
i have a rough understanding of lambda but so far only have found use
for it once(in tkinter when passing lambda as an argument i could
circumvent some tricky stuff).
what is the point of the following function?
def a
On 7 mai, 23:38, globalrev <[EMAIL PROTECTED]> wrote:
> i have a rough understanding of lambda but so far only have found use
> for it once(in tkinter when passing lambda as an argument i could
> circumvent some tricky stuff).
> what is the point of the following function?
>
> def addn(n):
>
On 7 Maj, 23:47, globalrev <[EMAIL PROTECTED]> wrote:
> and what si the diffrence here:
>
> g = lambda x=5:x*x
> g = lambda x:x*x
>
> the first was a mistake to write but it worked
> and the x=5 seems to be completely ignored. why? it has no effect at
> all?
ah wait now i see it has a default kind
and what si the diffrence here:
g = lambda x=5:x*x
g = lambda x:x*x
the first was a mistake to write but it worked
and the x=5 seems to be completely ignored. why? it has no effect at
all?
--
http://mail.python.org/mailman/listinfo/python-list
i have a rough understanding of lambda but so far only have found use
for it once(in tkinter when passing lambda as an argument i could
circumvent some tricky stuff).
what is the point of the following function?
def addn(n):
return lambda x,inc=n: x+inc
if i do addn(5) it returns
26 matches
Mail list logo