Re: a.index(float('nan')) fails

2012-10-25 Thread Steven D'Aprano
On Thu, 25 Oct 2012 18:46:20 -0700, mamboknave wrote: > That means, the function .index() cannot detect nan values. It happens > on both Python 2.6 and Python 3.1 > > Is this a bug? Or I am not using .index() correctly? You shouldn't be using index() or == to detect NANs. The right way to detec

Re: a.index(float('nan')) fails

2012-10-25 Thread Steven D'Aprano
On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote: > It is a consequence of the following, which some people (but not all) > believe is mandated by the IEEE standard. > > >>> nan = float('nan') > >>> nan is nan > True The IEEE 754 standard says nothing about object identity. It only discu

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread David Hutto
On Thu, Oct 25, 2012 at 9:08 PM, Rivka Miller wrote: > On Oct 25, 2:27 pm, Danny wrote: >> Why you just don't give us the string/input, say a line or two, and what you >> want off of it, so we can tell better what to suggest > > no one has really helped yet. > > I want to search and modify. > >

Re: SSH Connection with Python

2012-10-25 Thread Jason Friedman
> how can i create a SSH-Connection with python? I have to send some commands > to the remote host and parse their answers. Consider also the sh module: http://amoffat.github.com/sh/tutorials/2-interacting_with_processes.html. -- http://mail.python.org/mailman/listinfo/python-list

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread anon
On Thu, 25 Oct 2012 18:08:53 -0700 (PDT), Rivka Miller wrote in <73f60cf3-d932-4366-a405-676748856...@q16g2000yqc.googlegroups.com>: >no one has really helped yet. We regret that you are not a satisfied customer. Please take your receipt to the cashier and you will receive double your money bac

Re: SSH Connection with Python

2012-10-25 Thread Rodrick Brown
On Oct 25, 2012, at 6:34 AM, Schneider wrote: > Hi Folkz, > how can i create a SSH-Connection with python? I have to send some commands > to the remote host and parse their answers. > greatz Johannes Fabric is the way to go! > -- > http://mail.python.org/mailman/listinfo/python-list -- http:/

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread Rivka Miller
Thanks everyone, esp this gentleman. The solution that worked best for me is just to use a DOT before the string as the one at the beginning of the line did not have any char before it. I guess, this requires the ability to ignore the CARAT as the beginning of the line. I am a satisfied custormer

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread Devin Jeanpierre
On Thu, Oct 25, 2012 at 10:00 PM, Ed Morton wrote: > Because there is no solution - there IS no _RE_ that will match a string not > at the beginning of a line. Depending on what the OP meant, the following would both work: - r"^(?!mystring)" (the string does not occur at the beginning) - r"(?!^)

Re: while expression feature proposal

2012-10-25 Thread Dan Loewenherz
It seems the topic of this thread has changed drastically from the original message. 1) "while EXPR as VAR" in no way says that EXPR must be a boolean value. In fact, a use case I've run into commonly in web development is popping from a redis set. E.g. client = StrictRedis() while Tru

Re: a.index(float('nan')) fails

2012-10-25 Thread Cameron Simpson
On 25Oct2012 22:04, Terry Reedy wrote: | Containment of nan in collection is tested by is, not ==. | >>> nan = float('nan') | >>> nan2 = float('nan') | >>> nan2 is nan | False This argues otherwise, and for use of math.isnan() instead. I expect you were making the point that another NaN is di

Re: while expression feature proposal

2012-10-25 Thread Paul Rubin
Dan Loewenherz writes: > In this case, profile_id is "None" when the loop breaks. It would be > much more straightforward (and more Pythonic, IMO), to write: > > client = StrictRedis() > while client.spop("profile_ids") as profile_id: > print profile_id That is pretty loose, in my

Re: while expression feature proposal

2012-10-25 Thread Chris Angelico
On Fri, Oct 26, 2012 at 5:06 PM, Paul Rubin wrote: > Dan Loewenherz writes: >> In this case, profile_id is "None" when the loop breaks. It would be >> much more straightforward (and more Pythonic, IMO), to write: >> >> client = StrictRedis() >> while client.spop("profile_ids") as profile_

<    1   2