Re: sort array, apply rearrangement to second

2010-03-30 Thread MRAB
Victor Eijkhout wrote: I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those keys. Obviously I could turn them into a dictionary of pairs and sort by the first member, but I think that's not very efficient, at

Re: Re: Fetch files from mail in python

2010-03-30 Thread hidura
I did that but i want to know if i have a file inside the mail how could i download that file from my mail. On Mar 30, 2010 7:39pm, Chris Rebert wrote: On Tue, Mar 30, 2010 at 4:33 PM, hid...@gmail.com> wrote: > Hello list, i want to know how could i fetch a file from an email, what kind

Re: Re: Fetch files from mail in python

2010-03-30 Thread Chris Rebert
> On Mar 30, 2010 7:39pm, Chris Rebert wrote: >> On Tue, Mar 30, 2010 at 4:33 PM,  hid...@gmail.com> wrote: >> > Hello list, i want to know how could i fetch a file from an email, what >> > kind >> > of library i have to use for that, actually i am working in the support >> > of >> > IMAP and POP3

Re: "Usability, the Soul of Python"

2010-03-30 Thread Cameron Simpson
On 30Mar2010 10:25, Chris Colbert wrote: | not really, the int will eventually overflow and cycle around ;) | | On Tue, Mar 30, 2010 at 8:11 AM, Xavier Ho wrote: | | > Did no one notice that | > for(i = 99; i > 0; ++i) | > Gives you an infinite loop (sort of) because i starts a 99, and increase

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread John Bokma
Robert Fendt writes: > And thus spake John Bokma > Tue, 30 Mar 2010 13:19:19 -0600: > >> And >> >> a == b and 'Yes' or 'No' >> >> isn't a Perl-ism? > > I never said that this would be better. It was not my intention to imply you did. But yet I do see books on Python mention the and or usage

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote: > I have two arrays, made with numpy. The first one has values that I want > to use as sorting keys; the second one needs to be sorted by those keys. > Obviously I could turn them into a dictionary of pairs and sort by the > first member, bu

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert wrote: > > > On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote: > >> I have two arrays, made with numpy. The first one has values that I want >> to use as sorting keys; the second one needs to be sorted by those keys. >> Obviously I could turn t

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Russ P.
On Mar 30, 10:08 am, John Nagle wrote: > Chris Rebert wrote: > > On Tue, Mar 30, 2010 at 8:40 AM, gentlestone wrote: > >> Hi, how can I write the popular C/JAVA syntax in Python? > > >> Java example: > >>    return (a==b) ? 'Yes' : 'No' > > >> My first idea is: > >>    return ('No','Yes')[bool(a=

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Tim Chase
John Bokma wrote: And maybe you're right, the Python one could've been written: if list is None: list = [] which looks, now, also more readable to me as well. Though there's a slight difference[1], I'd usually use lst = lst or [] for your particular initialization use case. -tkc [1]

Re: sort array, apply rearrangement to second

2010-03-30 Thread Robert Kern
On 2010-03-30 18:25 , Victor Eijkhout wrote: I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those keys. Obviously I could turn them into a dictionary of pairs and sort by the first member, but I think that's n

Re: xpat error in xmlrp client. How to inspect data.

2010-03-30 Thread Gabriel Genellina
En Tue, 30 Mar 2010 18:01:40 -0300, News123 escribió: Gabriel Genellina wrote: En Thu, 25 Mar 2010 05:31:05 -0300, News123 escribió: I'm havign a small xmlrpc client, which works normally fine. (xmlrpc via https) Sometimes however I receive an Exception about an expat error. The output, t

Sublassing tuple works, subclassing list does not

2010-03-30 Thread Frank Millman
Hi all I needed something similar to, but not quite the same as, collections.namedtuple. The differences are that namedtuple requires the 'names' to be provided at creation time, and then lends itself to creating multiple instances of itself. I wanted a more generic class where I could suppl

<    1   2