Re: Help with changes in traceback stack from Python 2.7 to Python 3.x

2014-04-28 Thread Steven D'Aprano
On Mon, 28 Apr 2014 12:19:02 +1000, Chris Angelico wrote: > On Mon, Apr 28, 2014 at 12:11 PM, Steven D'Aprano > wrote: >> Suppose we could pass variables directly to the constructor, like this: >> >> a = b = 2 >> L = [1, 2, 3] >> dctA = dict(a, b, L[1], 2, 1+1) >> >> Obviously all five values are

Re: Unicode in Python

2014-04-28 Thread wxjmfauth
Le samedi 26 avril 2014 15:38:29 UTC+2, Ian a écrit : > On Apr 26, 2014 3:46 AM, "Frank Millman" wrote: > > > > > > > > > wrote in message > > > news:03bb12d8-93be-4ef6-94ae-4a02789ae...@googlegroups.com... > > > > == > > > > > > > > I wrote once 90 % of Python 2 apps (a generic te

Re: possible bug in re expression?

2014-04-28 Thread Robin Becker
On 25/04/2014 19:32, Terry Reedy wrote: .. I suppose that one could argue that '{' alone should be treated as special immediately, and not just when a matching '}' is found, and should disable other special meanings. I wonder what JS does if there is no matching '}'? well in fact I susp

Re: Inconsistent viewkeys behaviour

2014-04-28 Thread Terry Reedy
On 4/28/2014 2:22 AM, Joshua Landau wrote: Is there any reference for this strange behaviour on Python 2: >>> set() < dict().viewkeys() Traceback (most recent call last): File "", line 1, in TypeError: can only compare to a set >>> dict().viewkeys() > set() False

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-28 Thread Duncan Booth
Chris Angelico wrote: > # Snapshot of keys: > for k in list(d): > if f(k): del d[k] > > No extra loop at the end, no switching out and in of contents, just > one little change in the loop header. Obviously you don't want to do > this when you're deleting two out of three billion, but for sma

Re: possible bug in re expression?

2014-04-28 Thread Steven D'Aprano
On Mon, 28 Apr 2014 10:47:54 +0100, Robin Becker wrote: > Does this in fact that almost any broken regexp specification will > silently fail because re will reset and consider any metacharacter as > literal? Well, I don't know about "almost any", but at least some broken regexes will explicitly

problem with regex

2014-04-28 Thread dimmaim
i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple quotes test='''_*_n.jpg","timelineCoverPhoto":"{\"focus\":{\"x\":0.5,\"y\":0.386925795053},\"p

problem with regex

2014-04-28 Thread dimmaim
i want to find a specific urls from a txt file but i have some issus. First when i take just two lines from the file with copy paste and assign it to a variable like this and it works only with triple quotes test='''_*_n.jpg","timelineCoverPhoto":"{\"focus\":{\"x\":0.5,\"y\":0.386925795053},\"p

Re: problem with regex

2014-04-28 Thread Roy Smith
In article , dimm...@gmail.com wrote: > i want to find a specific urls from a txt file but i have some issus. First > when i take just two lines from the file with copy paste and assign it to a > variable like this and it works only with triple quotes > > test='' [...] > but if a take tho

Convert numpy array to single number

2014-04-28 Thread mboyd02255
I have a numpy array consisting of 1s and zeros for representing binary numbers: e.g. >>> binary array([ 1., 0., 1., 0.]) I wish the array to be in the form 1010, so it can be manipulated. I do not want to use built in binary converters as I am trying to build my own. -- https://m

Re: possible bug in re expression?

2014-04-28 Thread Robin Becker
On 28/04/2014 12:49, Steven D'Aprano wrote: .. Well, I don't know about "almost any", but at least some broken regexes will explicitly fail: py> import re sre_constants.error: nothing to repeat (For brevity I have abbreviated the traceback.) so there is intent to catch some

Re: Convert numpy array to single number

2014-04-28 Thread Steven D'Aprano
On Mon, 28 Apr 2014 06:04:02 -0700, mboyd02255 wrote: > I have a numpy array consisting of 1s and zeros for representing binary > numbers: > > e.g. > > >>> binary > array([ 1., 0., 1., 0.]) > > I wish the array to be in the form 1010, so it can be manipulated. > > I do not want to

Significant digits in a float?

2014-04-28 Thread Roy Smith
I'm using Python 2.7 I have a bunch of floating point values. For example, here's a few (printed as reprs): 38.0 41.2586 40.752801 49.25 33.7951994 36.8371996 34.1489 45.5 Fundamentally, these numbers have between 0 and 4 decimal digits of precision, and I want to be a

Re: Significant digits in a float?

2014-04-28 Thread Ned Batchelder
On 4/28/14 12:00 PM, Roy Smith wrote: Fundamentally, these numbers have between 0 and 4 decimal digits of precision, and I want to be able to intuit how many each has, ignoring the obvious floating point roundoff problems. Thus, I want to map: 38.0 ==> 0 41.2586 ==> 4 40.752801 ==> 4

Re: Significant digits in a float?

2014-04-28 Thread Chris Angelico
On Tue, Apr 29, 2014 at 2:00 AM, Roy Smith wrote: > I have a bunch of floating point values. For example, here's a few (printed > as reprs): > > 38.0 > 41.2586 > 40.752801 > 49.25 > 33.7951994 > 36.8371996 > 34.1489 > 45.5 > > Fundamentally, these numbers have between 0 a

Heartbleed and the windows distributions on python.org

2014-04-28 Thread Timothy McDonald
I am building a cherrypy app that is testing as vulnerable to the heartbleed exploit. The app is running on the 64 bit 3.3.5 Windows distribution of python. An updated version of 64 bit Python 3.3.x for Windows or an updated pyopenssl? I am kind of surprised the distribution on python.org hasen'

Re: Significant digits in a float?

2014-04-28 Thread Roy Smith
On Monday, April 28, 2014 12:28:59 PM UTC-4, Chris Angelico wrote: > Terminology question: Why do you count only what's after the decimal > point? I would describe these as having between 2 and 6 significant > figures. Will they always have two digits before the decimal, or does > your precision r

Re: Significant digits in a float?

2014-04-28 Thread Roy Smith
On Monday, April 28, 2014 12:07:14 PM UTC-4, Ned Batchelder wrote: > On 4/28/14 12:00 PM, Roy Smith wrote: >> 38.0 ==> 0 >> [...] >> Is there any clean way to do that? The best I've come up with so far is to >> str() them and parse the >> remaining string to see how many digits it put after the

Re: Significant digits in a float?

2014-04-28 Thread Ned Batchelder
On 4/28/14 2:39 PM, Roy Smith wrote: On Monday, April 28, 2014 12:07:14 PM UTC-4, Ned Batchelder wrote: On 4/28/14 12:00 PM, Roy Smith wrote: 38.0 ==> 0 [...] Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many

Re:Significant digits in a float?

2014-04-28 Thread Dave Angel
Roy Smith Wrote in message: > I'm using Python 2.7 > > I have a bunch of floating point values. For example, here's a few (printed > as reprs): > > 38.0 > 41.2586 > 40.752801 > 49.25 > 33.7951994 > 36.8371996 > 34.1489 > 45.5 > > Fundamentally, these numbers have betwe

Re: Heartbleed and the windows distributions on python.org

2014-04-28 Thread Ned Deily
In article , Timothy McDonald wrote: > I am building a cherrypy app that is testing as vulnerable to the heartbleed > exploit. The app is running on the 64 bit 3.3.5 Windows distribution of > python. An updated version of 64 bit Python 3.3.x for Windows or an updated > pyopenssl? I am kind of

Re:Convert numpy array to single number

2014-04-28 Thread Dave Angel
mboyd02...@gmail.com Wrote in message: > I have a numpy array consisting of 1s and zeros for representing binary > numbers: > > e.g. > > >>> binary > array([ 1., 0., 1., 0.]) > > I wish the array to be in the form 1010, so it can be manipulated. > > I do not want to use built in b

Re:problem with regex

2014-04-28 Thread Dave Angel
dimm...@gmail.com Wrote in message: > i want to find a specific urls from a txt file but i have some issus. First > when i take just two lines from the file with copy paste and assign it to a > variable like this and it works only with triple quotes > > test='''_*_n.jpg","timelineCoverPhoto":"{

Re: Help with changes in traceback stack from Python 2.7 to Python 3.x

2014-04-28 Thread Ned Batchelder
On 4/27/14 5:51 PM, Andrew Konstantaras wrote: I guess I am missing something big as I am looking for a shorthand way of doing the following: dctA = dict(x=x, y=y, ... n=n) Yes, your makeDict(x, y) is a shorthand for dict(x=x, y=y), but there are many things you can do with dict

Re: Help with changes in traceback stack from Python 2.7 to Python 3.x

2014-04-28 Thread Andrew Konstantaras
On Apr 28, 2014, at 12:36 PM, Ned Batchelder wrote: On 4/27/14 5:51 PM, Andrew Konstantaras wrote: > I guess I am missing something big as I am looking for a shorthand way > of doing the following: > > dctA = dict(x=x, y=y, ... n=n) > Yes, your makeDict(x,

Re: Sorting list alphabetically

2014-04-28 Thread Terry Reedy
On 4/28/2014 2:33 AM, Kev Dwyer wrote: Hello Terry, Regarding your second point, my mistake in not checking the link: I'd seen a similar one elsewhere and assumed they were the same. This link should work: http://msdn.microsoft.com/en-us/library/hzz3tw78 As to your first point, you're right,

Re: Soap list and soap users on this list

2014-04-28 Thread Burak Arslan
Hi Joseph, Sorry for the late response, I seem to have missed this post. On 04/17/14 21:34, Joseph L. Casale wrote: > I've been looking at Spyne to produce a service that > can accept a request formatted as follows: > > > http://..."; xmlns:xsi=http:/..." > xmlns:xsd="http://...";> > > >

RE: Soap list and soap users on this list

2014-04-28 Thread Joseph L. Casale
> https://gist.github.com/plq/11384113 > > Unfortunately, you need the latest Spyne from > https://github.com/arskom/spyne, this doesn't work with 2.10 > > 2.11 is due around end of may, beginning of june. > > Ping back if you got any other questions. Burak, Thanks a ton! I've just pulled this

Re: Help with changes in traceback stack from Python 2.7 to Python 3.x

2014-04-28 Thread Chris Angelico
On Tue, Apr 29, 2014 at 5:50 AM, Andrew Konstantaras wrote: > Actually, that is one of the nice features of using a dictionary, I can > check if the key is there and if it is pull it out. As I was dusting off > this old code, I considered trying to implement this functionality through > by creati

Re: MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-28 Thread Matthew Pounsett
On Sunday, 27 April 2014 10:33:38 UTC-4, Chris Angelico wrote: > In most contexts, "thread unsafe" simply means that you can't use the > same facilities simultaneously from two threads (eg a lot of database > connection libraries are thread unsafe with regard to a single > connection, as they'll

Re: MacOS 10.9.2: threading error using python.org 2.7.6 distribution

2014-04-28 Thread Chris Angelico
On Tue, Apr 29, 2014 at 8:50 AM, Matthew Pounsett wrote: > Thanks, I'll keep all that in mind. I have to wonder how much of a problem > it is here though, since I was able to demonstrate a functioning fork inside > a new thread further up in the discussion. > Yeah, it's really hard to pin down

Re: Inconsistent viewkeys behaviour

2014-04-28 Thread Gregory Ewing
Terry Reedy wrote: The left operand determines the result. The manual specifies that < and > do not have to be consistent. But I suspect that when 3.x dict.keys() was backported to 2.7.0, no one thought to update set, whereas the backported key view code already had the comparison. The quest

Re: Significant digits in a float?

2014-04-28 Thread Steven D'Aprano
On Mon, 28 Apr 2014 12:00:23 -0400, Roy Smith wrote: [...] > Fundamentally, these numbers have between 0 and 4 decimal digits of > precision, I'm surprised that you have a source of data with variable precision, especially one that varies by a factor of TEN THOUSAND. The difference between 0 a

Re: Significant digits in a float?

2014-04-28 Thread Ben Finney
Steven D'Aprano writes: > By the way, you contradict yourself here. Earlier, you described 38.0 as > having zero decimal places (which is wrong). Here you describe it as > having one, which is correct, and then in a later post you describe it as > having zero decimal places again. I get the i

Re: Significant digits in a float?

2014-04-28 Thread Steven D'Aprano
On Tue, 29 Apr 2014 13:23:07 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> By the way, you contradict yourself here. Earlier, you described 38.0 >> as having zero decimal places (which is wrong). Here you describe it as >> having one, which is correct, and then in a later post you desc

Re: Sorting list alphabetically

2014-04-28 Thread Kev Dwyer
Terry Reedy wrote: > On 4/28/2014 2:33 AM, Kev Dwyer wrote: > >> Hello Terry, >> >> Regarding your second point, my mistake in not checking the link: >> I'd seen a similar one elsewhere and assumed they were the same. >> >> This link should work: >> http://msdn.microsoft.com/en-us/library/hzz3tw7