Ajit Deshpande wrote:
I am trying to figure out where lambda functions can be useful. Has anyone
used them in real world?
Of course. lambdas are especially useful for callback functions, which
are especially common when doing GUI programming.
From my reading so far, I hear people claim tha
"Ajit Deshpande" wrote
I am trying to figure out where lambda functions can be useful. Has
anyone
used them in real world?
Yers lots of people, all over the place. They are very useful things.
Why would anyone use a one liner anonymous function,
To pass as an argument to another functio
>
>
>
>> In my continuing quest the find the best way of doing this I came across
>> the following method:
>>
>> for thread in threading.enumerate():
>> if thread is not threading.currentThread():
>> thread.join()
>> print 'FINISHED'
>>
>> In my newbie understanding, you
On 01/-10/-28163 02:59 PM, Ajit Deshpande wrote:
I am trying to figure out where lambda functions can be useful. Has anyone
used them in real world?
From my reading so far, I hear people claim that lambda can be a useful
replacement for small functions. Most examples didn't make much sense to
On 01/-10/-28163 02:59 PM, Joel Goldstick wrote:
2011/3/19 Yaşar Arabacı
a=5
b=5
a == b
True
a is b
True
My question is, why "a is b" is true. What I expected it to be is that, a
and b are different things with same value.
___
Tutor maillist -
This is a special feature called interning in python. As of Python 2.6,
values of -5 to 105 are never cleared from memory for performance reasons.
This is applicable to integers only.
"==" is a value comparator, whereas "is" is a reference compartor.
Check this interesting extension to your code:
2011/3/19 Yaşar Arabacı :
a=5
b=5
a == b
> True
a is b
> True
>
> My question is, why "a is b" is true. What I expected it to be is that, a
> and b are different things with same value.
>
It's an optimization thing. When you type "a=5," the python
interpreter is obligated to give y
On Saturday 2011 March 19 08:35, Emmanuel Ruellan wrote:
> 2011/3/19 Yaşar Arabacı
>
> > >>>a=5
> > >>>b=5
> > >>>a == b
> >
> > True
> >
> > >>>a is b
> >
> > True
> >
> > My question is, why "a is b" is true. What I expected it to be is that, a
> > and b are different things with same value.
>
>
2011/3/19 Yaşar Arabacı
>
>
> >>>a=5
> >>>b=5
> >>>a == b
> True
> >>>a is b
> True
>
> My question is, why "a is b" is true. What I expected it to be is that, a
> and b are different things with same value.
>
Even stranger:
>>> a = 10**10
>>> b = 10**10
>>> a == b
True
>>> a is b
False
>>> a =
In my Python Pipelines program I have the following
opts = {
'characters' : (lambda rec, tot: tot + len(rec), 0),
'words' : (lambda rec, tot: tot + len(rec.split()), 0),
'lines' : (lambda rec, tot: tot + 1, 0),
'minline' :(lambda rec, tot: min(len(rec), tot), 9
On 3/19/2011 9:44 AM, Ajit Deshpande wrote:
I am trying to figure out where lambda functions can be useful. Has
anyone used them in real world?
From my reading so far, I hear people claim that lambda can be a
useful replacement for small functions. Most examples didn't make
much sense to me.
On 19/03/11 14:44, Ajit Deshpande wrote:
I am trying to figure out where lambda functions can be useful. Has
anyone used them in real world?
From my reading so far, I hear people claim that lambda can be a
useful replacement for small functions. Most examples didn't make
much sense to me. Wh
2011/3/19 Yaşar Arabacı
> >>>a=5
> >>>b=5
> >>>a == b
> True
> >>>a is b
> True
>
> My question is, why "a is b" is true. What I expected it to be is that, a
> and b are different things with same value.
>
> ___
> Tutor maillist - Tutor@python.org
> T
2011/3/19 Yaşar Arabacı
> >>>a=5
> >>>b=5
> >>>a == b
> True
> >>>a is b
> True
>
> My question is, why "a is b" is true. What I expected it to be is that, a
> and b are different things with same value.
>
> ___
> Tutor maillist - Tutor@python.org
> T
>>>a=5
>>>b=5
>>>a == b
True
>>>a is b
True
My question is, why "a is b" is true. What I expected it to be is that,
a and b are different things with same value.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
h
I am trying to figure out where lambda functions can be useful. Has anyone
used them in real world?
>From my reading so far, I hear people claim that lambda can be a useful
replacement for small functions. Most examples didn't make much sense to
me. Why would anyone use a one liner anonymous func
>
>
>> Only really glanced at this, but you seem to be checking only the last
>>> thread *after* the loop? Surely you should be storing all the threads in a
>>> list (or someplace) as you create them, and then check them all for liveness
>>> and if so join them each in turn, to ensure you only pri
"Steven D'Aprano" wrote
with how to get binary to text, so your suggestions are greatly
appreciated.
I'll get to it! (0001 = a, 0010 = b, ...)
>>> int('01101110', 2)
110
>>> chr(110)
'n'
And if you really want to use non standard character values you
could look at the string maket
18 matches
Mail list logo