Re: The Samurai Principle

2010-09-11 Thread Robert Kern
On 9/11/10 7:08 PM, Lawrence D'Oliveiro wrote: In message, Robert Kern wrote: On 9/10/10 5:17 PM, Lawrence D'Oliveiro wrote: In message, Ian Kelly wrote: And returning None on failure is dangerous, because if the programmer does not take care to handle that case, the program may attempt to

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread David Cournapeau
On Sun, Sep 12, 2010 at 4:26 AM, Stefan Behnel wrote: > _wolf, 11.09.2010 20:15: >> >> does anyone have a suggestion for a ready-to-go, fast kdtree >> implementation for python 3.1 and up, for nearest-neighbor searches? i >> used to use the one from numpy/scipy, but find it a pain to install >> fo

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Ben Finney
Neil Hodgson writes: > There appear to be deliberate wraps at sentence end or automatic wraps > to fit <80 columns. The automatic wraps in the code presented in the message are wrong. The automatic wraps in the bullet point list are, if not wrong, at least presumably unintended. I hope that cle

Re: The Samurai Principle

2010-09-11 Thread Lawrence D'Oliveiro
In message , Robert Kern wrote: > On 9/10/10 5:17 PM, Lawrence D'Oliveiro wrote: > >> In message, Ian >> Kelly wrote: >> >>> And returning None on failure is dangerous, because if the programmer >>> does not take care to handle that case, the program may attempt to >>> regard it as actual data. >

Re: audio time-stretching?

2010-09-11 Thread Patrick Charron
On Tue, 07 Sep 2010 15:33:55 +, kj wrote: > Does anyone know of a Python module for *moderate* "time-stretching"[1] > an MP3 (or AIFF) file? > > FWIW, the audio I want to time-stretch is human speech. If you are running your script on Linux you may use gstreamer(pyGST). With gstreamer you c

Re: Static typing, Python, D, DbC

2010-09-11 Thread John Nagle
On 9/11/2010 9:36 AM, Lie Ryan wrote: On 09/12/10 00:33, Bearophile wrote: Lately while I program with Python one of the D features that I most miss is a built-in Design By Contract (see PEP 316), because it avoids (or helps me to quickly find and fix) many bugs. In my opinion

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread _wolf
> Do you know about the kdtree implementation in biopython? I don't know > if it is already available for Python 3, but for me it worked fine in > Python 2.X. i heard they use a brute-force approach and it's slow. that's just rumors alright. also, judging from the classes list on http://www.biopyt

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Cameron Simpson
On 10Sep2010 12:46, Daniel Fetchinson wrote: | > Raymond Hettinger writes: | >> It doesn't seem to be common knowledge when and how a[x] gets | >> translated to a[x+len(x)]. So, here's a short info post on how Python | >> supports negative indices for sequences. | > | > Thanks for this. Could yo

Re: is there a library/program that converts sqlite database from windows-1252 to utf-8 ?

2010-09-11 Thread Robert Kern
On 9/11/10 4:45 PM, Stef Mientki wrote: On 11-09-2010 21:11, Robert Kern wrote: SQLite internally stores its strings as UTF-8 or UTF-16 encoded Unicode. So it's not clear what you mean when you say the database is "windows-1252". Can you be more specific? I doubt that, but I'm not sure ...

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Neil Hodgson
Ben Finney: > For those who think the problem may be with the recipient's software, I > see the same annoying line-wrapping problems in the archived message > http://mail.python.org/pipermail/python-list/2010-September/1255167.html>. That looks well-formatted to me and just the same as I see i

Re: is there a library/program that converts sqlite database from windows-1252 to utf-8 ?

2010-09-11 Thread Stef Mientki
On 11-09-2010 21:11, Robert Kern wrote: > SQLite internally stores its strings as UTF-8 or UTF-16 encoded Unicode. So > it's not clear what > you mean when you say the database is "windows-1252". Can you be more > specific? I doubt that, but I'm not sure ... For some databases written by other p

Re: play sound on Ubuntu 10.4. (pulse audio?)

2010-09-11 Thread Tim Harig
On 2010-09-11, News123 wrote: > What would be the way to detect how to play audio on a linux system > without knowing ufront whether the system uses pulse, ALSA or whatever? I would suggest libao: http://www.xiph.org/ao/ and it's python bindings: http://nixbit.com/cat/multimedia/a

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread _wolf
> Since you're looking for an implementation, I guess you won't be the one > volunteering to maintain such code in the stdlib, would you? this is indeed a problem. i am probably not the right one for this kind of task. however, i do sometimes feel like the standard library carries too much cruft

Re: palindrome iteration

2010-09-11 Thread Aahz
In article , Dave Angel wrote: > >def is_palindrom(s): >s = s.lower() >return s == s[::-1] To deal with "real" palindromes such as, "Madam, I'm Adam," you should probably strip all spaces and punctuation: # untested pat = re.compile(r'[a-z]') def is_palindrome(s): letters = pat.find

Re: How to Convert IO Stream to XML Document

2010-09-11 Thread naugiedoggie
On Sep 10, 12:20 pm, jakecjacobson wrote: > I am trying to build a Python script that reads a Sitemap file and > push the URLs to a Google Search Appliance.  I am able to fetch the > XML document and parse it with regular expressions but I want to move > to using native XML tools to do this.  The

play sound on Ubuntu 10.4. (pulse audio?)

2010-09-11 Thread News123
Hi, >From a python script I'd like to play sound on Ubuntu 10.4 I made two attempts: the first one is drectly writing to '/dev/audio', which works, but only if no other application plays audio (like for example amarok) The second attempt was playing audio via ALSA. The application doesn't fail

Bug: urllib2 basic authentication does not trap auth failure in windows?

2010-09-11 Thread naugiedoggie
Hello, Is this a known issue? I have a script that authenticates to a web service. urllib2 process for authenticating for basic auth is supposed to dump out after 5 retries. Here's a note from the urllib2.py code: def http_error_auth_reqed(self, auth_header, host, req, headers): a

SOLVED: Re: Trap Authentication Errors in HTTP Request

2010-09-11 Thread naugiedoggie
On Sep 10, 12:09 pm, naugiedoggie wrote: > Hello, > > I have a script that authenticates to a web service provider to > retrieve data.  This script provides an authentication header built in > a very basic way like this: The answer is that there is something whacked in the Windoze implementation

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread Marco Nawijn
On 11 sep, 20:15, _wolf wrote: > does anyone have a suggestion for a ready-to-go, fast kdtree > implementation for python 3.1 and up, for nearest-neighbor searches? i > used to use the one from numpy/scipy, but find it a pain to install > for python 3. also, i'm trying to wrap the code > fromhttp

Re: fast kdtree tree implementation for python 3?

2010-09-11 Thread Stefan Behnel
_wolf, 11.09.2010 20:15: does anyone have a suggestion for a ready-to-go, fast kdtree implementation for python 3.1 and up, for nearest-neighbor searches? i used to use the one from numpy/scipy, but find it a pain to install for python 3. The latest release is supposed to work with Py3. also

Re: is there a library/program that converts sqlite database from windows-1252 to utf-8 ?

2010-09-11 Thread Robert Kern
SQLite internally stores its strings as UTF-8 or UTF-16 encoded Unicode. So it's not clear what you mean when you say the database is "windows-1252". Can you be more specific? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by

is there a library/program that converts sqlite database from windows-1252 to utf-8 ?

2010-09-11 Thread Stef Mientki
thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

fast kdtree tree implementation for python 3?

2010-09-11 Thread _wolf
does anyone have a suggestion for a ready-to-go, fast kdtree implementation for python 3.1 and up, for nearest-neighbor searches? i used to use the one from numpy/scipy, but find it a pain to install for python 3. also, i'm trying to wrap the code from http://code.google.com/p/kdtree/ using cython

Re: Hide DOS console for .pyc file

2010-09-11 Thread Terry Reedy
On 9/11/2010 6:32 AM, Lawrence D'Oliveiro wrote: In message, Peter Otten wrote: Lawrence D'Oliveiro wrote: In message <3a2d194c-9b34-4b84-8680-28bdfb53b...@y3g2000vbm.googlegroups.com>, Muddy Coder wrote: For a quick testing purpose, I deliver .pyc files to my customer. I don't want the bla

Re: triangle python user's group?

2010-09-11 Thread fields
Tim: trizpug.org - fields On Aug 31, 12:38 pm, "Tim Arnold" wrote: > "Albert Hopkins" wrote in message > > news:mailman.219.1283200967.29448.python-l...@python.org... > > > On Mon, 2010-08-30 at 12:38 -0700, Tim Arnold wrote: > >> Hi, > >> Is there a python users group in the Research Triangle

Re: Static typing, Python, D, DbC

2010-09-11 Thread Lie Ryan
On 09/12/10 00:33, Bearophile wrote: > > > Lately while I program with Python one of the D features that I most > miss is a built-in Design By Contract (see PEP 316), because it avoids > (or helps me to quickly find and fix) many bugs. In my opinion DbC is > also very good used w

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-11 Thread Thomas Jollans
On Saturday 11 September 2010, it occurred to Lawrence D'Oliveiro to exclaim: > In message , MRAB > > wrote: > > On 08/09/2010 19:07, Georg Brandl wrote: > >> Thus spake the Lord: Thou shalt indent with four spaces. No more, no > >> less. Four shall be the number of spaces thou shalt indent, and t

Re: bug in python documentation?

2010-09-11 Thread Vito 'ZeD' De Tullio
Benjamin Kaplan wrote: > You're looking at the 2.7 documentation. Are you using 2.7? whoops, no: 2.6.5 :\ (but the "new in python X.Y.Z" disclaimer does not apply to the example snippets?) -- By ZeD -- http://mail.python.org/mailman/listinfo/python-list

Re: bug in python documentation?

2010-09-11 Thread Thomas Jollans
On Saturday 11 September 2010, it occurred to Vito 'ZeD' De Tullio to exclaim: > from http://docs.python.org/library/unittest.html > > $ python test_unittest.py > .E. > == > ERROR: test_sample (__main__.TestSequenceFunctions) > --

Re: bug in python documentation?

2010-09-11 Thread Benjamin Kaplan
On Sat, Sep 11, 2010 at 11:34 AM, Vito 'ZeD' De Tullio wrote: > from http://docs.python.org/library/unittest.html > > -->8>8>8>8>8>8>8>8>8>8>8>8-- > > Here is a short script to test three functions from the random module: > > import random > import unitt

bug in python documentation?

2010-09-11 Thread Vito 'ZeD' De Tullio
from http://docs.python.org/library/unittest.html -->8>8>8>8>8>8>8>8>8>8>8>8-- Here is a short script to test three functions from the random module: import random import unittest class TestSequenceFunctions(unittest.TestCase): def setUp(self):

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Aahz
In article <87vd6d84f7@benfinney.id.au>, Ben Finney wrote: >Ben Finney writes: >> Raymond Hettinger writes: >>> >>> It doesn't seem to be common knowledge when and how a[x] gets >>> translated to a[x+len(x)]. So, here's a short info post on how >>> Python supports negative indices for seque

Static typing, Python, D, DbC

2010-09-11 Thread Bearophile
I write some Python code almost every day, but lately I am using a lot the D language too. After using D for about three years I now know some of it, but when I need to write short (< about 1000 lines) *correct* programs, Python is still the more productive for me. Static typing, and the usage of

Design: Module interface vs. library interface

2010-09-11 Thread Stefan Schwarzer
Hello, I maintain ftputil [1], an FTP client library. Users of the library may use it like this: | import ftputil | | with ftputil.FTPHost(server, userid, password) as ftp_host: | # for example, make a remote file and read its content | with ftp_host.open("remote_name", "rb") as remote_f

Re: 3D cube navigation

2010-09-11 Thread rav
On Sep 10, 9:10 pm, sahilsk wrote: > hi, i need to make a 3d cube as a navigation menu.. each face having > separate  button .. or effect. > any idea,  how can i make one such 3D figures with functionality of > mouse events? One of options is AS3 and Papervision3D - free Flex SDK and many tutoria

Re: Hide DOS console for .pyc file

2010-09-11 Thread Lawrence D'Oliveiro
In message , Peter Otten wrote: > Lawrence D'Oliveiro wrote: > >> In message >> <3a2d194c-9b34-4b84-8680-28bdfb53b...@y3g2000vbm.googlegroups.com>, Muddy >> Coder wrote: >> >>> For a quick testing purpose, I deliver .pyc files to my customer. I >>> don't want the black DOS console appearing behi

Re: SendKeys and Python 2.7

2010-09-11 Thread Lawrence D'Oliveiro
In message , Jakson A. Aquino wrote: > On Sat, Sep 11, 2010 at 4:25 AM, Lawrence D'Oliveiro > wrote: > >> In message , Jakson >> A. Aquino wrote: >> >>> Your code do send the ^v as expected, but I have problem with the >>> selection of the Windows which will receive the ^v. The code above was >>

Re: SendKeys and Python 2.7

2010-09-11 Thread Jakson A. Aquino
On Fri, Sep 10, 2010 at 10:38 PM, MRAB wrote: > I'd add some more small sleeps to give Windows/R time to act, IYSWIM. I > learned that from experience. :-) I've tried adding sleeps, small and large, but they didn't make much of a difference. Anyway, different machines could require different amou

Re: Hide DOS console for .pyc file

2010-09-11 Thread Peter Otten
Lawrence D'Oliveiro wrote: > In message > <3a2d194c-9b34-4b84-8680-28bdfb53b...@y3g2000vbm.googlegroups.com>, Muddy > Coder wrote: > >> For a quick testing purpose, I deliver .pyc files to my customer. I >> don't want the black DOS console appearing behind my GUI, but I have >> no idea how to do

Re: SendKeys and Python 2.7

2010-09-11 Thread Jakson A. Aquino
On Sat, Sep 11, 2010 at 4:25 AM, Lawrence D'Oliveiro wrote: > In message , Jakson A. > Aquino wrote: > >> Your code do send the ^v as expected, but I have problem with the >> selection of the Windows which will receive the ^v. The code above was OK >> in a Windows XP running inside VirtualBox, but

Re: Hide DOS console for .pyc file

2010-09-11 Thread Dave Angel
On 2:59 PM, Muddy Coder wrote: Hi Folks, For a quick testing purpose, I deliver .pyc files to my customer. I don't want the black DOS console appearing behind my GUI, but I have no idea how to do it. Somebody can help? Thanks! Cosmo In Windows, the executable file statically determines wheth

Re: Refactoring similar subclasses

2010-09-11 Thread Steven D'Aprano
On Sat, 11 Sep 2010 08:53:38 +0200, Peter Otten wrote: > Steven D'Aprano wrote: > >> I have some code that currently takes four different classes, A, B, C >> and D, and subclasses each of them in the same way: [...] >> Any suggestions or guidelines? > > You could use a mixin: Nice! I'll give it

Re: Hide DOS console for .pyc file

2010-09-11 Thread Steven D'Aprano
On Fri, 10 Sep 2010 20:28:52 -0700, Muddy Coder wrote: > Hi Folks, > > For a quick testing purpose, I deliver .pyc files to my customer. I > don't want the black DOS console appearing behind my GUI, but I have no > idea how to do it. Somebody can help? Thanks! Google is your friend. Googling fo

Re: SendKeys and Python 2.7

2010-09-11 Thread Lawrence D'Oliveiro
In message , Jakson A. Aquino wrote: > Your code do send the ^v as expected, but I have problem with the > selection of the Windows which will receive the ^v. The code above was OK > in a Windows XP running inside VirtualBox, but when tested in a real > machine, it proved to be highly inconsisten

Re: SendKeys and Python 2.7

2010-09-11 Thread Lawrence D'Oliveiro
In message , Jakson A. Aquino wrote: > On Fri, Sep 10, 2010 at 7:19 PM, Lawrence D'Oliveiro > wrote: > >> In message , Jakson >> A. Aquino wrote: >> >>> On Fri, Sep 10, 2010 at 6:26 AM, Lawrence D'Oliveiro >>> wrote: >> In message , Jakson A. Aquino wrote: > I would like to s

Re: Hide DOS console for .pyc file

2010-09-11 Thread Lawrence D'Oliveiro
In message <3a2d194c-9b34-4b84-8680-28bdfb53b...@y3g2000vbm.googlegroups.com>, Muddy Coder wrote: > For a quick testing purpose, I deliver .pyc files to my customer. I > don't want the black DOS console appearing behind my GUI, but I have > no idea how to do it. Somebody can help? Thanks! Don’t

Re: Refactoring similar subclasses

2010-09-11 Thread Peter Otten
Steven D'Aprano wrote: > I have some code that currently takes four different classes, A, B, C and > D, and subclasses each of them in the same way: > > class MyA(A): > def method(self, x): > result = super(MyA, self).method(x) > if result == "spam": > return "spam