Ben Finney wrote:
> mosscliffe <[EMAIL PROTECTED]> writes:
>
>> I have tried the following, for a one dimensional list and it works,
>> but I can not get my head around this lambda. How would this be
>> written, without the lamda ?
>>
>> mylist = ['Fred','bill','PAUL','albert']
>>
>> mylist.sort(
"Joe" <[EMAIL PROTECTED]> wrote:
> I am new to lambda and have searched for a few hours this morning, coming up
> empty handed. Is this possible?
Seeing as it has happened, it must be.
- Hendrik
--
http://mail.python.org/mailman/listinfo/python-list
mosscliffe <[EMAIL PROTECTED]> writes:
> I have tried the following, for a one dimensional list and it works,
> but I can not get my head around this lambda. How would this be
> written, without the lamda ?
>
> mylist = ['Fred','bill','PAUL','albert']
>
> mylist.sort(key=lambda el: el.lower())
He
On 8 Jun, 16:39, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, mosscliffe
> wrote:
>
> > I have tried the following, for a one dimensional list and it works,
> > but I can not get my head around this lambda. How would this be
> > written, without the lamda ?
>
> Well
> > Now, I would like to be able to specify which index to sort by. I am
> not
> > able to pass in external variables like:
> >
> > List.sort(key=lambda el: el[indexNumber].lower())
>
> Why ever not?
Sorry, I should have written back with my findings. I had run into the
problem described in thi
On 6/8/07, Joe <[EMAIL PROTECTED]> wrote:
> Now, I would like to be able to specify which index to sort by. I am not
> able to pass in external variables like:
>
> List.sort(key=lambda el: el[indexNumber].lower())
Why ever not?
--
Cheers,
Simon B.
[EMAIL PROTECTED]
http://www.brunningonline.net
> Try:
>
> list.sort(key=lambda el: el[0].lower())
Now, I would like to be able to specify which index to sort by. I am not
able to pass in external variables like:
List.sort(key=lambda el: el[indexNumber].lower())
I am new to lambda and have searched for a few hours this morning, coming up
em
In <[EMAIL PROTECTED]>, mosscliffe
wrote:
> I have tried the following, for a one dimensional list and it works,
> but I can not get my head around this lambda. How would this be
> written, without the lamda ?
Well ``lambda``\s are just anonymous functions so you can write it with a
named functio
> Try:
>
> list.sort(key=lambda el: el[0].lower())
Thanks! Worked like a charm :)
> BUT - it's not a good idea to use list as a name, 'cos list is a
> built-in, and you're obscuring it.
Oh, don't worry. That was strictly my portrayal of the problem.
Thanks again!
Jough
--
http://mail.pyth
On 8 Jun, 14:18, "Simon Brunning" <[EMAIL PROTECTED]> wrote:
> On 6/7/07, Joe <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a list of lists that I would like to sort utilizing a certain index
> > of the nested list. I am able to successfully use:
>
> > Import operator
> > list = [["Apple", 1], ["air
On 6/7/07, Joe <[EMAIL PROTECTED]> wrote:
>
> I have a list of lists that I would like to sort utilizing a certain index
> of the nested list. I am able to successfully use:
>
> Import operator
> list = [["Apple", 1], ["airplane", 2]]
> list.sort(key=operator.itemgetter(0))
>
> But, unfortunately,
11 matches
Mail list logo