Re: False and 0 in the same dictionary

2008-11-04 Thread Hendrik van Rooyen
"Prateek" <[EMAIL PROTECTED]> wrote: > >>> b = {0:'xyz', False:'abc'} > >>> b > {0: 'abc'} # Am I the only one who thinks this is weird? No. This was discussed before on this list, and that discussion referenced (if I recall correctly) the discussion on python-dev at the time the decision was

[JOB] Senior Python Engineer, NYC - Relo OK - 150-250k

2008-11-04 Thread Beau Gould
Job Title: Senior Python Engineer Location: New York City - Relocation assistance provided Salary: $150,000 - $250,000 per year + benefits Entrepreneurial. Challenging. Exciting. Fun. Innovative. Edgy. Distinctive. Sound like an interesting job? Our company was born out of a passion for bring

Django or TurboGears or Pylons? for python web framework.

2008-11-04 Thread 3000 billg
Hi Senior, There was a case for web site that will be public to Internet for me. I like python so I do not consider the use of Ruby on Rails. I searched more web framework of python from Google. The good solution just only there are Django, TurboGears and Pylons. Just from my preferences, I want

Re: Which was the best Lib of GUI for python

2008-11-04 Thread 3000 billg
Thank everybody for your good idea. 2008/11/5 Mike Driscoll <[EMAIL PROTECTED]> > On Nov 4, 9:39 am, Joe Strout <[EMAIL PROTECTED]> wrote: > > On Nov 3, 2008, at 10:53 PM, 3000 billg wrote: > > > > > I am a leaner. for your experience. Which GUI Lib will be the best > > > for Python? wxpython, Tk

Re: developing python extensions with CDT and Pydev in Eclipse

2008-11-04 Thread Joachim Dahl
Fabio Zadrozny wrote: Has anyone been able to use both Pydev and CDT to debug extension modules? The question was asked about a year ago on this list, and I am hoping that someone has figured it out in meantime. Previous answers on that: https://sourceforge.net/forum/message.php?msg_id

Financial crisis came in to farm industry. Viagra sell 300 percents

2008-11-04 Thread fernandena
http://farmos.freetzi.com/ Financial crisis came in to farm industry. Viagra sell 300 percents -- http://mail.python.org/mailman/listinfo/python-list

Re: XMPP xmpppy - User Authorization

2008-11-04 Thread James Mills
On Wed, Nov 5, 2008 at 11:28 AM, James Mills <[EMAIL PROTECTED]> wrote: > Can anyone shed any light on how I might > be able to react to "User Authorization Requests" > from other users on an XMPP server/network > using teh xmlpp [1] library ? [SOLVED}: I found out from having a peek at jabberbot

Re: PEP 249 - DB API question

2008-11-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, James Mills wrote: > Try spawning a new process to run your query in. One approach might be to have two processes: the worker process and the watcher process. The worker does the work, of course. Before performing any call that may hang, the worker sends a message

Re: Problem when Installing PyML module modules with mingw32

2008-11-04 Thread Rich Healey
AON LAZIO wrote: > On Tue, Nov 4, 2008 at 9:25 PM, Rich Healey <[EMAIL PROTECTED] > > wrote: > Why remove "###Bla bla bla bunch of errors###" > > How do we help without the error messages! > AON LAZIO wrote: > Ah, sorry but the error was quite long in nature. here

Re: Rewriting a bash script in python

2008-11-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Chris Jones wrote: > I wrote this in bash and although it's worked w/o a glitch for the last > couple of months .. I'm not comfortable with .. "the look & feel of it". Engineering rule #1: if it works, don't fix it. -- http://mail.python.org/mailman/listinfo/python

Re: Rewriting a bash script in python

2008-11-04 Thread Ben Finney
Chris Jones <[EMAIL PROTECTED]> writes: > I am thinking of rewriting it in python using OOP tactics/strategy. > > Please advise. I advise you not to have the object-oriented programming hammer as your only tool, because it's easy to then treat every problem as though it were a nail. What you de

Rewriting a bash script in python

2008-11-04 Thread Chris Jones
I wrote a trivial backup script that does the following: If tonight is the first day of the month: save last month's archive do a full backup of the system else: save last night's differential backup back up all changes relative to the current month's full backup endif I wrote

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Wed, 05 Nov 2008 13:18:27 +1100, Ben Finney wrote: > > > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > > > Your example shows only that they're important for grouping the > > expression from surrounding syntax. As I said. > >

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Marc 'BlackJack' Rintsch
On Wed, 05 Nov 2008 13:18:27 +1100, Ben Finney wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > Your example shows only that they're important for grouping the > expression from surrounding syntax. As I said. > > They are *not* important for making the expresison be a generator

Re: Finding the instance reference of an object

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 18:00:35 -0800, George Sakkis wrote: > On Nov 4, 6:02 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > >> I know you really want Python to be unique and special -- and it is, in >> many ways, but this isn't one of them.  Python is an OOP language whose >> variables contain referenc

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 20:25:09 -0500, Steve Holden wrote: > I think there'd be no advantage to a sort method on a generator, since > theoretically the last item could be the first required in the sorted > sequence, so it's necessary to hold all items in memory to ensure the > sort is correct. So the

Re: Regexp parser and generator

2008-11-04 Thread Paul McGuire
On Nov 4, 1:34 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > Is there any package that parses regular expressions and returns an > AST ? Something like: > > >>> parse_rx(r'i (love|hate) h(is|er) (cat|dog)s?\s*!+') > > Regex('i ', Or('love', 'hate'), ' h', Or('is', 'er'), ' ', Or('cat', > 'dog'), O

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-04 Thread david . lyon
Hi Kurda, I have been through this problem. Somebody needs to write a FAQ. Took me a few days to pinpoint the problem. Don't know which platform but I assume Linux... Python depends upon Sqlite... which is weird... but it is what I discovered... When Python is being built.. it checks for sql

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-04 Thread Kurda Yon
On Nov 4, 8:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Nov 5, 6:47 am, Kurda Yon <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I try to "build" and "install" pysqlite? After I type "python setup.py > > build" I get a lot of error messages? The first error is "src/ > > connection.h:33:

Re: Problem when Installing PyML module modules with mingw32

2008-11-04 Thread Rich Healey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 AON LAZIO wrote: > Hi, > I have a problem when I try to install PyML module with mingw32 in > windows XP. > > c prompt>python setup.py build --compiler=mingw32 > running build > running build_py > running build_ext > building 'PyML/containers/ext/

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > I think there'd be no advantage to a sort method on a generator, > since theoretically the last item could be the first required in the > sorted sequence Worse, generators don't necessarily *have* a finite set of items, and there's no way in general of t

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Wed, 05 Nov 2008 12:06:42 +1100, Ben Finney wrote: > > > Falcolas <[EMAIL PROTECTED]> writes: > > > >> Using the surrounding parentheses creates a generator object > > > > No. Using the generator expression syntax creates a generator > >

Problem when Installing PyML module modules with mingw32

2008-11-04 Thread AON LAZIO
Hi, I have a problem when I try to install PyML module with mingw32 in windows XP. c prompt>python setup.py build --compiler=mingw32 running build running build_py running build_ext building 'PyML/containers/ext/_csparsedataset' extention ###Bla bla bla bunch of errors### collect2: ld returned

Re: how to call this dll in python

2008-11-04 Thread Shark
On Nov 4, 2:16 pm, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Shark" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > >I have a windows dll1.dll with a export function: > > > int f1(char filename,char **buf,int *bufLen) > > { > > int len; > > //got the length of file anyway,suc

Re: Finding the instance reference of an object

2008-11-04 Thread George Sakkis
On Nov 4, 6:02 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > I know you really want Python to be unique and special -- and it is,   > in many ways, but this isn't one of them.  Python is an OOP language   > whose variables contain references to objects, and where such   > references are passed (by v

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-04 Thread [EMAIL PROTECTED]
On Nov 5, 6:47 am, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I try to "build" and "install" pysqlite? After I type "python setup.py > build" I get a lot of error messages? The first error  is "src/ > connection.h:33:21: error: sqlite3.h: No such file or directory". So, > I assume that the abse

How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-04 Thread Kurda Yon
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or directory". So, I assume that the absence of the "sqlite3.h" is the origin of the problem. I found on th

Re: Sending multi-part MIME package via HTTP-POST

2008-11-04 Thread Justin Ezequiel
have you tried using the def request(self, method, url, body=None, headers={}) method instead of putrequest, endheaders, send methods? where body is --===1845688244== Content-Type: application/vnd.cip4-jmf+xml MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: beginning

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Marc 'BlackJack' Rintsch
On Wed, 05 Nov 2008 12:06:42 +1100, Ben Finney wrote: > Falcolas <[EMAIL PROTECTED]> writes: > >> Using the surrounding parentheses creates a generator object > > No. Using the generator expression syntax creates a generator object. > > Parentheses are irrelevant to whether the expression is a

Re: What's your choice when handle complicated C structures.

2008-11-04 Thread Marc 'BlackJack' Rintsch
On Tue, 04 Nov 2008 16:52:17 -0800, 一首诗 wrote: > Now I'm using the upack function of 'struct' module, but it's really > annoying to write fmt strings for complicated structures. > > What will be your choice when handling binary structures? http://construct.wikispaces.com/ Ciao, Marc 'Bl

Re: developing python extensions with CDT and Pydev in Eclipse

2008-11-04 Thread Fabio Zadrozny
> Has anyone been able to use both Pydev and CDT to debug extension > modules? > > The question was asked about a year ago on this list, and I am hoping > that > someone has figured it out in meantime. Previous answers on that: https://sourceforge.net/forum/message.php?msg_id=4268986 https://so

XMPP xmpppy - User Authorization

2008-11-04 Thread James Mills
Hi all, Can anyone shed any light on how I might be able to react to "User Authorization Requests" from other users on an XMPP server/network using teh xmlpp [1] library ? Thanks, cheers James [1] http://xmpppy.sourceforge.net/irc/ -- -- -- "Problems are solved by method" -- http://mail.pytho

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Steve Holden
tmallen wrote: > On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: >> tmallen: >> >>> I'm parsing some text files, and I want to strip blank lines in the >>> process. Is there a simpler way to do this than what I have here? >>> lines = filter(lambda line: len(line.strip()) > 0, lines) >> xlines = (line f

Re: Finding the instance reference of an object

2008-11-04 Thread Marc 'BlackJack' Rintsch
On Tue, 04 Nov 2008 16:02:29 -0700, Joe Strout wrote: > On Nov 4, 2008, at 3:42 PM, Steven D'Aprano wrote: > >>> This example is also call-by-value, but the value in this case is a >>> type >>> that has no analog in Python. >> >> I'm disappointed to see that my prediction that Joe would, yet agai

Re: What's your choice when handle complicated C structures.

2008-11-04 Thread Daniel Fetchinson
> Recently I am writing a small network application with python. > > The protocol is binary based and defined in c header files. > > Now I'm using the upack function of 'struct' module, but it's really > annoying to write fmt strings for complicated structures. > > What will be your choice when han

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
Falcolas <[EMAIL PROTECTED]> writes: > Using the surrounding parentheses creates a generator object No. Using the generator expression syntax creates a generator object. Parentheses are irrelevant to whether the expression is a generator expression. The parentheses merely group the expression fr

Re: What's your choice when handle complicated C structures.

2008-11-04 Thread Diez B. Roggisch
一首诗 schrieb: Hi all, Recently I am writing a small network application with python. The protocol is binary based and defined in c header files. Now I'm using the upack function of 'struct' module, but it's really annoying to write fmt strings for complicated structures. What will be your choi

What's your choice when handle complicated C structures.

2008-11-04 Thread 一首诗
Hi all, Recently I am writing a small network application with python. The protocol is binary based and defined in c header files. Now I'm using the upack function of 'struct' module, but it's really annoying to write fmt strings for complicated structures. What will be your choice when handlin

PyOpenGL + wxPython developer needed

2008-11-04 Thread Clay Hobbs
I am working on a map editor for BZFlag (http://www.bzflag.org/), and I need help. Mostly, all I need help on is 3D rendering. I know nothing about OpenGL, so if you do, your help would be appreciated. The program I am making is called RatBZEdit (http://ratbzedit.sourceforge.net/). If you are i

Re: PEP 249 - DB API question

2008-11-04 Thread James Mills
On Wed, Nov 5, 2008 at 6:13 AM, k3xji <[EMAIL PROTECTED]> wrote: > >> Try spawning a new process to run your query >> in. Use the multiprocessing library. Your main >> application can then just poll the db/query processes >> to see if they're a) finished and b) have a result >> >> Your application

Re: Finding the instance reference of an object

2008-11-04 Thread Aaron Brady
On Nov 4, 5:02 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 4, 2008, at 3:42 PM, Steven D'Aprano wrote: > > When we're talking about the value of a variable in Python, why on   > > earth > > would you drag entities that do not exist in Python into the   > > discussion? > > I don't, but others

Re: Error loading modules

2008-11-04 Thread John Machin
On Nov 5, 9:18 am, BL <[EMAIL PROTECTED]> wrote: > I am very new to python.  I am installing it as part of a bazzar > version control installation. > I have installed the Crypto, paramiko and cElementTree modules.  I am > running Solaris10x86. > When testing the modules I get the following results.

Re: Ordering python sets

2008-11-04 Thread MRAB
On Nov 4, 8:40 pm, Lie Ryan <[EMAIL PROTECTED]> wrote: [snip] > On linguistic note: As a non-native speaker of English, I've never relied > on the correct usage of Yes and No and would instead rely on the > following text. In some languages, situations where English-people > usually use Yes is answ

Re: Building loop with some exceptions?

2008-11-04 Thread alex23
On Nov 5, 5:20 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > I need to call a URL through a loop that starts at 01 and ends at 99, > but some of the steps must be ignored: exclusions = [04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89] for i in (x for x in xrange(1,100) if x not in exclusions):

Re: split() and string.whitespace

2008-11-04 Thread bearophileHUGS
MRAB: > I also had the thought that the backtick (`), which is not used in > Python 3, could be used to form character set literals (`aeiou` => > set("aeiou")), although that might only be worth while if character > sets were introduced as an specialised form of set. Python developers have removed

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread tmallen
Between this info and http://www.python.org/doc/2.5.2/tut/node11.html#SECTION0011100 , I'm starting to understand how I'll use generators (I've seen them mentioned before, but never used them knowingly). > list_o_lines = [line for line in open(filename) if line.strip()] +1 for "l

Re: Building loop with some exceptions?

2008-11-04 Thread MRAB
On Nov 4, 10:02 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > On Nov 4, 1:26 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > > > On Tue, 4 Nov 2008 11:22:27 -0800 (PST), Aaron Brady > > > <[EMAIL PROTECTED]> wrote: > > >> for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: > > > >sorte

Re: locating the chorus in a MIDI song?

2008-11-04 Thread Mr . SpOOn
On Tue, Nov 4, 2008 at 5:20 AM, Joe Strout <[EMAIL PROTECTED]> wrote: > We've got a need to generate short "samples" of songs that are in MIDI > format, to provide a preview function in a web app. We'd like to do > something more clever than just taking the middle 20 seconds (or whatever) > of the

Re: split() and string.whitespace

2008-11-04 Thread MRAB
On Nov 4, 8:00 pm, [EMAIL PROTECTED] wrote: > MRAB: > > > It's interesting, if you think about it, that here we have someone who > > wants to split on a set of characters but 'split' splits on a string, > > and others sometimes want to strip off a string but 'strip' strips on > > a set of character

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Falcolas
On Nov 4, 3:30 pm, tmallen <[EMAIL PROTECTED]> wrote: > On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: > > > tmallen: > > > > I'm parsing some text files, and I want to strip blank lines in the > > > process. Is there a simpler way to do this than what I have here? > > > lines = filter(lambda line: le

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread bearophileHUGS
tmallen > I must be missing something: > > >>> xlines = (line for line in open("new.data") if line.strip()) > >>> xlines > > >>> xlines.sort() > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'generator' object has no attribute 'sort' > > What do you think? Congratu

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
tmallen <[EMAIL PROTECTED]> writes: > On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: > > xlines = (line for line in open(filename) if line.strip()) > > I must be missing something: > > >>> xlines = (line for line in open("new.data") if line.strip()) > >>> xlines > A generator http://www.python.or

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Ben Finney
Larry Bates <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > xlines = (line for line in open(filename) if line.strip()) > > Of if you want to filter/loop at the same time, or if you don't want > all the lines in memory at the same time The above implementation creates a generator; so i

Re: False and 0 in the same dictionary

2008-11-04 Thread Ben Finney
Prateek <[EMAIL PROTECTED]> writes: > >>> b = {0:'xyz', False:'abc'} > >>> b > {0: 'abc'} # Am I the only one who thinks this is weird? You're not the only one; I consider this a wart in Python. False and True should be discrete values that don't compare equal with any other value, not even one

Re: Finding the instance reference of an object

2008-11-04 Thread Joe Strout
On Nov 4, 2008, at 3:54 PM, Steven D'Aprano wrote: At the level of Python code, Python operates on *objects*. When you call a function with an argument, the argument (an object) is NOT copied, it is passed to the function. If you mutate the argument inside the function, you are changing the

Re: Finding the instance reference of an object

2008-11-04 Thread Joe Strout
On Nov 4, 2008, at 3:42 PM, Steven D'Aprano wrote: This example is also call-by-value, but the value in this case is a type that has no analog in Python. I'm disappointed to see that my prediction that Joe would, yet again, utterly ignore all the arguments against his pet theory was correct.

Re: Which PostgreSQL adapter to use?

2008-11-04 Thread Ben Finney
Hussein B <[EMAIL PROTECTED]> writes: > Which Adapter to use with PostgreSQL: > PyPgSQL, psycopg or PyGreSQL? I have found the best overall interface for working with an RDBMS in Python is SQLAlchemy http://www.sqlalchemy.org/>. To use SQLAlchemy with PostgreSQL requires psycopg2. So that's what

Re: Finding the instance reference of an object

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 09:16:05 -0800, Craig Allen wrote: > When you consider the status of the entity "x" in "x=1" in python, it is > a pointer, and python looks like pass by value. Nonsense. Python doesn't have pointers. You're letting Joe confuse you. Python has objects: *everything* in Python i

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Chris Rebert
On Tue, Nov 4, 2008 at 2:30 PM, tmallen <[EMAIL PROTECTED]> wrote: > On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: >> tmallen: >> >> > I'm parsing some text files, and I want to strip blank lines in the >> > process. Is there a simpler way to do this than what I have here? >> > lines = filter(lambda

Re: Finding the instance reference of an object

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 09:06:45 -0700, Joe Strout wrote: > This example is also call-by-value, but the value in this case is a type > that has no analog in Python. I'm disappointed to see that my prediction that Joe would, yet again, utterly ignore all the arguments against his pet theory was corre

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 13:27:00 -0800, tmallen wrote: > I'm parsing some text files, and I want to strip blank lines in the > process. Is there a simpler way to do this than what I have here? > > lines = filter(lambda line: len(line.strip()) > 0, lines) > > Thomas lines = filter(lambda line: line

Re: [2.5.1] Building loop with some exceptions?

2008-11-04 Thread Steven D'Aprano
On Tue, 04 Nov 2008 20:20:20 +0100, Gilles Ganault wrote: > Hello > > I need to call a URL through a loop that starts at 01 and ends at 99, > but some of the steps must be ignored: ... > I'm clueless at what the Python way is to do this :-/ Perhaps you should start by doing the Python tutorial,

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread tmallen
On Nov 4, 4:30 pm, [EMAIL PROTECTED] wrote: > tmallen: > > > I'm parsing some text files, and I want to strip blank lines in the > > process. Is there a simpler way to do this than what I have here? > > lines = filter(lambda line: len(line.strip()) > 0, lines) > > xlines = (line for line in open(fi

Distributed unit testing on condor?

2008-11-04 Thread gardnerpomper
Hi, I have a system where I would like to run unittests over our condor distributed cluster. My thoughts have been to write tests which take a list of files, and distribute each file and that test out as a condor job. I have briefly looked at nose and its plugins to see if I could set something up

Error loading modules

2008-11-04 Thread BL
I am very new to python. I am installing it as part of a bazzar version control installation. I have installed the Crypto, paramiko and cElementTree modules. I am running Solaris10x86. When testing the modules I get the following results. python -c "import Crypto" Traceback (most recent call la

Re: Building loop with some exceptions?

2008-11-04 Thread Gilles Ganault
On Tue, 4 Nov 2008 12:10:28 -0800 (PST), Matimus <[EMAIL PROTECTED]> wrote: >I would just do something like this (not tested): Thanks a lot guys :-) Worked first time. I just have the usual issue with ASCII/Unicode: === cursor.execute(sql) UnicodeDecodeError: 'ascii' codec can't decode b

Re: Building loop with some exceptions?

2008-11-04 Thread Aaron Brady
On Nov 4, 1:26 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > On Tue, 4 Nov 2008 11:22:27 -0800 (PST), Aaron Brady > > <[EMAIL PROTECTED]> wrote: > >> for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: > > >sorted( list( set( domain ) - set( exceptions ) ) ) > > >Set subtraction. >

Re: False and 0 in the same dictionary

2008-11-04 Thread Arnaud Delobelle
Prateek <[EMAIL PROTECTED]> writes: > On Nov 5, 1:52 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Prateek <[EMAIL PROTECTED]> wrote: >> > I've been using Python for a while (4 years) so I feel like a moron >> > writing this post because I think I should know the answer to this >> > question: >>

Re: False and 0 in the same dictionary

2008-11-04 Thread bdbull
On Nov 4, 4:21 pm, Prateek <[EMAIL PROTECTED]> wrote: > On Nov 5, 1:52 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > Prateek <[EMAIL PROTECTED]> wrote: > > > I've been using Python for a while (4 years) so I feel like a moron > > > writing this post because I think I should know the answer to t

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread Larry Bates
[EMAIL PROTECTED] wrote: tmallen: I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) > 0, lines) xlines = (line for line in open(filename) if line.strip()) Bye, bea

Re: Is there a better/simpler way to filter blank lines?

2008-11-04 Thread bearophileHUGS
tmallen: > I'm parsing some text files, and I want to strip blank lines in the > process. Is there a simpler way to do this than what I have here? > lines = filter(lambda line: len(line.strip()) > 0, lines) xlines = (line for line in open(filename) if line.strip()) Bye, bearophile -- http://mail.

Is there a better/simpler way to filter blank lines?

2008-11-04 Thread tmallen
I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) > 0, lines) Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending multi-part MIME package via HTTP-POST

2008-11-04 Thread [EMAIL PROTECTED]
Sadly, there is no way to increase the log verbosity. On Oct 17, 2:42 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message > <[EMAIL PROTECTED]>, > > > > [EMAIL PROTECTED] wrote: > > On Oct 15, 2:42 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > > central.gen.new_z

Re: False and 0 in the same dictionary

2008-11-04 Thread Prateek
On Nov 5, 1:52 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Prateek <[EMAIL PROTECTED]> wrote: > > I've been using Python for a while (4 years) so I feel like a moron > > writing this post because I think I should know the answer to this > > question: > > > How do I make a dictionary which has dis

Sieve of Zakiya

2008-11-04 Thread jzakiya
Update: 2008/11/03 Architecture & coding improvements. Renamed generators. I am 90% finished writing up a mathematical analysis of my method. In the process I found an architectural optimization to the sieve process which is incorporated in the new code. Complexity analysis showing other interest

Re: Exact match with regular expression

2008-11-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Mr.SpOOn wrote: > On Sat, Nov 1, 2008 at 1:57 AM, Lawrence D'Oliveiro > <[EMAIL PROTECTED]> wrote: > >> Funny how you never get a thank-you when you tell people to RTFM. > > My fault :\ > I said "thank you" to Rob, but I just sent a private message. It's > just tha

Re: False and 0 in the same dictionary

2008-11-04 Thread Duncan Booth
Prateek <[EMAIL PROTECTED]> wrote: > I've been using Python for a while (4 years) so I feel like a moron > writing this post because I think I should know the answer to this > question: > > How do I make a dictionary which has distinct key-value pairs for 0, > False, 1 and True. How about using

False and 0 in the same dictionary

2008-11-04 Thread Prateek
I've been using Python for a while (4 years) so I feel like a moron writing this post because I think I should know the answer to this question: How do I make a dictionary which has distinct key-value pairs for 0, False, 1 and True. As I have learnt, 0 and False both hash to the same value (same f

Re: Building loop with some exceptions?

2008-11-04 Thread bearophileHUGS
Gilles Ganault: > Thanks a lot but... I don't know what the above means :-/ set(iterable) just builds a set, then you use the really usual set semantics. Anyway, maybe you may find this more easy to understand: refused_indexes = set([4, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89]) for i in xrange(1,

Re: Ordering python sets

2008-11-04 Thread Lie Ryan
On Sun, 02 Nov 2008 02:08:37 +, Steven D'Aprano wrote: > On Sat, 01 Nov 2008 18:58:59 +, Tim Rowe wrote: > >> 2008/10/27 <[EMAIL PROTECTED]>: >>> Lie Ryan: >>> Oh no, the two dict implementation would work _exactly_ the same from the outside, they are transparently interchangeabl

Re: Parse each line by character location

2008-11-04 Thread bearophileHUGS
George Sakkis: > Here's a general solution for fixed size records: > >>> def slicer(*sizes): > > ...     slices = len(sizes) * [None] > ...     start = 0 > ...     for i,size in enumerate(sizes): > ...         stop = start+size > ...         slices[i] = slice(start,stop) > ...         start = stop

Re: Regexp parser and generator

2008-11-04 Thread Peter Otten
George Sakkis wrote: > Is there any package that parses regular expressions and returns an > AST ? Something like: > parse_rx(r'i (love|hate) h(is|er) (cat|dog)s?\s*!+') > Regex('i ', Or('love', 'hate'), ' h', Or('is', 'er'), ' ', Or('cat', > 'dog'), Optional('s'), ZeroOrMore(r'\s'), OneOrMo

Re: separate shared libraries or different Linux/Unix

2008-11-04 Thread Martin v. Löwis
> How do I get zlib available to python? Edit Modules/Setup, and uncomment the zlib line. At your choice, also uncomment the *shared* line (otherwise, zlib would become a builtin module). When you install shared libraries somewhere that also live in /usr/lib, do use ldd to verify that it always p

Re: PEP 249 - DB API question

2008-11-04 Thread k3xji
> Try spawning a new process to run your query > in. Use the multiprocessing library. Your main > application can then just poll the db/query processes > to see if they're a) finished and b) have a result > > Your application server can also c0 kill long running > queries that are "deemed" to be t

Re: Building loop with some exceptions?

2008-11-04 Thread Matimus
On Nov 4, 11:20 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > I need to call a URL through a loop that starts at 01 and ends at 99, > but some of the steps must be ignored: > > = > url = "http://www.acme.com/list?code="; > p = re.compile("^(\d+)\t(.+)$") > > for i=01 to 99 except 04

Re: split() and string.whitespace

2008-11-04 Thread bearophileHUGS
MRAB: > It's interesting, if you think about it, that here we have someone who > wants to split on a set of characters but 'split' splits on a string, > and others sometimes want to strip off a string but 'strip' strips on > a set of characters (passed as a string). That can be seen as a little in

Re: Regexp parser and generator

2008-11-04 Thread skip
George> Is there any package that parses regular expressions and returns George> an AST ? Maybe not directly, but this might provide a starting point for building such a beast: >>> import re >>> re.compile("[ab]", 128) in literal 97 literal 98 <_sre.SRE_Patter

Re: Building loop with some exceptions?

2008-11-04 Thread Benjamin Kaplan
On Tue, Nov 4, 2008 at 2:26 PM, Gilles Ganault <[EMAIL PROTECTED]> wrote: > On Tue, 4 Nov 2008 11:22:27 -0800 (PST), Aaron Brady > <[EMAIL PROTECTED]> wrote: > >> for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: > > > >sorted( list( set( domain ) - set( exceptions ) ) ) > > > >Set

Re: Parse each line by character location

2008-11-04 Thread Tim Chase
recno_idx = slice(0,10) client_idx = slice(10, 11) volume_idx = slice(11,11+10) order_type_idx = slice(11+10, 11+10+3) . !? That seems to me confusingly far from a working solution, at least in comparison to recno_idex = the_line[0:10] client_idx = the_li

Regexp parser and generator

2008-11-04 Thread George Sakkis
Is there any package that parses regular expressions and returns an AST ? Something like: >>> parse_rx(r'i (love|hate) h(is|er) (cat|dog)s?\s*!+') Regex('i ', Or('love', 'hate'), ' h', Or('is', 'er'), ' ', Or('cat', 'dog'), Optional('s'), ZeroOrMore(r'\s'), OneOrMore('!')) Given such a structure,

Re: Unyeilding a permutation generator

2008-11-04 Thread Jorgen Grahn
On 3 Nov 2008 22:13:42 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 03 Nov 2008 21:09:58 +, Jorgen Grahn wrote: > >> Why multi-threading? I see no concurrency in the original algorithm. >> There is, in my mind, nothing concurrent about 'yield'. > > No "real" concurrency b

Re: Building loop with some exceptions?

2008-11-04 Thread Gilles Ganault
On Tue, 4 Nov 2008 11:22:27 -0800 (PST), Aaron Brady <[EMAIL PROTECTED]> wrote: >> for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: > >sorted( list( set( domain ) - set( exceptions ) ) ) > >Set subtraction. Thanks a lot but... I don't know what the above means :-/ -- http://mail.p

Re: Building loop with some exceptions?

2008-11-04 Thread Aaron Brady
On Nov 4, 1:20 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > I need to call a URL through a loop that starts at 01 and ends at 99, > but some of the steps must be ignored: > > = > url = "http://www.acme.com/list?code="; > p = re.compile("^(\d+)\t(.+)$") > > for i=01 to 99 except 04,

[2.5.1] Building loop with some exceptions?

2008-11-04 Thread Gilles Ganault
Hello I need to call a URL through a loop that starts at 01 and ends at 99, but some of the steps must be ignored: = url = "http://www.acme.com/list?code="; p = re.compile("^(\d+)\t(.+)$") for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: f = urllib.urlopen(url + i)

Re: Parse each line by character location

2008-11-04 Thread Arnaud Delobelle
[EMAIL PROTECTED] (Cameron Laird) writes: > In article <[EMAIL PROTECTED]>, > Tim Chase <[EMAIL PROTECTED]> wrote: >>> I hope this is the right place to ask, but I am trying to come up with >>> a way to parse each line of a file. Unfortunately, the file is neither >>> comma, nor tab, nor space de

Re: Parse each line by character location

2008-11-04 Thread Benjamin Kaplan
On Tue, Nov 4, 2008 at 11:45 AM, Tyler <[EMAIL PROTECTED]> wrote: > Hello All: > > I hope this is the right place to ask, but I am trying to come up with > a way to parse each line of a file. Unfortunately, the file is neither > comma, nor tab, nor space delimited. Rather, the character locations

Re: Parse each line by character location

2008-11-04 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Tim Chase <[EMAIL PROTECTED]> wrote: >> I hope this is the right place to ask, but I am trying to come up with >> a way to parse each line of a file. Unfortunately, the file is neither >> comma, nor tab, nor space delimited. Rather, the character locations >> imply

Re: Simple textual calendar

2008-11-04 Thread Jorgen Grahn
On Mon, 3 Nov 2008 18:02:19 -0800 (PST), Mensanator <[EMAIL PROTECTED]> wrote: ... >> <[EMAIL PROTECTED]> wrote: ... >> >I'm trying to write out a calendar for a year, in this form (imaginary ... > Personally, I find the tradtional format > worthless. I want to see the year represented as a single

Re: PEP 249 - DB API question

2008-11-04 Thread M.-A. Lemburg
On 2008-11-04 18:52, k3xji wrote: > Hi all, > > As development goes on for a server project, it turns out that I am > using the MySQLDB and DB interactions excessively. One questions is > just bothering me, why don't we have a timeout for queries in PEP 249 > (DB API)? > > Is it really safe to wa

Re: python_and_WSDL

2008-11-04 Thread Stefan Behnel
Dejan Pangercic wrote: > question is, does anyone know about any up2date equivalent for > connecting to WSDL from python? It seems like you missed soaplib. Compared to other Python SOAP libraries, it's pretty easy to use. Stefan -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >