Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread Wolfgang Meiners
Am 24.02.12 14:37, schrieb Rick Johnson: > I get sick and tired of doing this!!! > > if maxlength == UNLIMITED: > allow_passage() > elif len(string) > maxlength: > deny_passage() > > What Python needs is some constant that can be compared to ANY numeric > type and that constant will ALWAY

Python packaging usabilty (distutils) - automatic downloading required packages

2012-02-25 Thread XLiIV
There is many packaging solutions for python. I was confused about that but it's nothing. I had to pick one of them. I picked distutils because it's part of standard python since 3.3, am i right? My goal is to write setup.py with this feature: 'download required package if not installed already, li

Re: Python packaging usabilty (distutils) - automatic downloading required packages

2012-02-25 Thread Stefan Behnel
XLiIV, 25.02.2012 15:47: > There is many packaging solutions for python. > I was confused about that but it's nothing. I had to pick one of them. > I picked distutils because it's part of standard python since 3.3, am > i right? Distutils has been part of Python's stdlib for ages. > My goal is t

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread Serhiy Storchaka
25.02.12 02:37, MRAB написав(ла): We already have arbitrarily long ints, so there could be a special infinite int singleton (actually, 2 of them, one positive, the other negative). float('inf') and float('-inf'). -- http://mail.python.org/mailman/listinfo/python-list

importing python modules from java

2012-02-25 Thread Jeffrey Hubbard
Hello, I have written a c++ library which embeds python functions as described in http://docs.python.org/extending/embedding.html. Everything works fine, I can import and use modules such as numpy by calling PyImport_ImportModule(...). Now I wrapped this c++ library for java using SWIG. However,

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread MRAB
On 25/02/2012 08:18, Wolfgang Meiners wrote: Am 24.02.12 14:37, schrieb Rick Johnson: I get sick and tired of doing this!!! if maxlength == UNLIMITED: allow_passage() elif len(string)> maxlength: deny_passage() What Python needs is some constant that can be compared to ANY numer

[RELEASED] Release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3

2012-02-25 Thread Benjamin Peterson
We're pleased to announce the immediate availability of release candidates for Python 2.6.8, 2.7.3, 3.1.5, and 3.2.3 . The main impetus for these releases is fixing a security issue in Python's hash based types, dict and set, as described below. Python 2.7.3 and 3.2.3 include the security patch and

Re: Python math is off by .000000000000045

2012-02-25 Thread Tobiah
> For every floating point > number there is a corresponding real number, but 0% of real numbers > can be represented exactly by floating point numbers. It seems to me that there are a great many real numbers that can be represented exactly by floating point numbers. The number 1 is an example.

Re: Python math is off by .000000000000045

2012-02-25 Thread Tim Wintle
On Sat, 2012-02-25 at 09:56 -0800, Tobiah wrote: > > For every floating point > > number there is a corresponding real number, but 0% of real numbers > > can be represented exactly by floating point numbers. > > It seems to me that there are a great many real numbers that can be > represented

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread Rick Johnson
On Feb 24, 6:35 pm, Mark Lawrence wrote: > I understand that a Python integer can run to infinity.  Quite how the > illustrious rr manages to test for the length of a string that's already > used all of the memory on his system has baffled me, When did i ever say that i would need a string who's

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread Rick Johnson
On Feb 25, 11:54 am, MRAB wrote: > [...] > That should be: > if maxlength is not None and len(string) <= maxlength: Using "imaginary" infinity values defiles the intuitive nature of your code. What is more intuitive? def confine_length(string, maxlength=INFINITY): if string.length < maxlengt

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-25 Thread Rick Johnson
On Feb 24, 7:50 pm, Steven D'Aprano wrote: > But it would also be rejected, and rightly so, as unnecessary complexity > for the int type. There are already Decimal and float infinities, just > use one of them. Sure there are float INFINITIES that work fine for ints and floats, but where is the c

Re: Python math is off by .000000000000045

2012-02-25 Thread Terry Reedy
On 2/25/2012 12:56 PM, Tobiah wrote: It seems to me that there are a great many real numbers that can be represented exactly by floating point numbers. The number 1 is an example. Binary floats can represent and integer and any fraction with a denominator of 2**n within certain ranges. For de

Re: Python math is off by .000000000000045

2012-02-25 Thread jmfauth
>>> (2.0).hex() '0x1.0p+1' >>> (4.0).hex() '0x1.0p+2' >>> (1.5).hex() '0x1.8p+0' >>> (1.1).hex() '0x1.1999ap+0' >>> jmf -- http://mail.python.org/mailman/listinfo/python-list

Udacity CS 101

2012-02-25 Thread Josh English
Has anyone here looked at Udacity's open CS101 course (http://www.udacity.com/overview/Course/cs101) that started this week? The goal of the seven week course is to build a web crawler. So far, I'm not impressed with the speed or content of the course. I was wondering what anyone here may think

Re: asynchronous downloading

2012-02-25 Thread Richard Baron Penman
>> I read through the python-dev archives and found the fundamental problem is >> no one maintains asnycore / asynchat. > > Well, actually I do/did. ah OK. I had read this comment from a few years back: "IIRC, there was a threat to remove asyncore because there were no maintainers, no one was fix

Re: Python math is off by .000000000000045

2012-02-25 Thread Steven D'Aprano
On Sat, 25 Feb 2012 13:25:37 -0800, jmfauth wrote: (2.0).hex() > '0x1.0p+1' (4.0).hex() > '0x1.0p+2' (1.5).hex() > '0x1.8p+0' (1.1).hex() > '0x1.1999ap+0' > jmf What's your point? I'm afraid my crystal ball is out of order

webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Leo
Hello, On Lion and with its stock python version 2.7.1 r271:86832, webbrowser.open('file://localhost/nonexistingfile') always opens up Safari. Is this a bug? Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python math is off by .000000000000045

2012-02-25 Thread Devin Jeanpierre
On Sat, Feb 25, 2012 at 2:08 PM, Tim Wintle wrote: > > It seems to me that there  are a great many real numbers that can be > > represented exactly by floating point numbers.  The number 1 is an > > example. > > > > I suppose that if you divide that count by the infinite count of all > > real numb

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Anthony Nguyen
If Safari is your default browser, Python will open the address in Safari. >From the Python docs: webbrowser.open(url[, new=0[, autoraise=True]]) Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is ope

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Steven D'Aprano
On Sun, 26 Feb 2012 09:33:15 +0800, Leo wrote: > Hello, > > On Lion and with its stock python version 2.7.1 r271:86832, > webbrowser.open('file://localhost/nonexistingfile') always opens up > Safari. Is this a bug? What part of this do you think is the bug, and why? What part of the behaviour a

Re: Python math is off by .000000000000045

2012-02-25 Thread Terry Reedy
On 2/25/2012 9:49 PM, Devin Jeanpierre wrote: What this boils down to is to say that, basically by definition, the set of numbers representable in some finite number of binary digits is countable (just count up in binary value). But the whole of the real numbers are uncountable. The hard part i

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Leo
On 2012-02-26 11:36 +0800, Steven D'Aprano wrote: > What part of this do you think is the bug, and why? What part of the > behaviour actually experienced contradicts the documented behaviour of > webbrowser.open()? > > http://docs.python.org/library/webbrowser.html If you have the default browse

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Cameron Simpson
On 26Feb2012 14:23, Leo wrote: | On 2012-02-26 11:36 +0800, Steven D'Aprano wrote: | > What part of this do you think is the bug, and why? What part of the | > behaviour actually experienced contradicts the documented behaviour of | > webbrowser.open()? | > | > http://docs.python.org/library/web

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Steven D'Aprano
On Sun, 26 Feb 2012 14:23:43 +0800, Leo wrote: > On 2012-02-26 11:36 +0800, Steven D'Aprano wrote: >> What part of this do you think is the bug, and why? What part of the >> behaviour actually experienced contradicts the documented behaviour of >> webbrowser.open()? >> >> http://docs.python.org/li

Re: webbrowser.open always opens up Safari on Lion

2012-02-25 Thread Leo
On 2012-02-26 15:04 +0800, Cameron Simpson wrote: > On the suppostion that "the default browser" is actually multiple > settings, one for each of several URL (URI?) schemes, what do these two > shell commands do for you? From a shell prompt in a Terminal: > > open file://localhost/nonexistingfile