Re: SQLite date fields

2010-11-25 Thread Tim Roberts
Alan Harris-Reid wrote: > >I am having design problems with date storage/retrieval using Python and >SQLite. > >I understand that a SQLite date column stores dates as text in ISO >format (ie. '2010-05-25'). Only if you store it that way. >So when I display a British date (eg. on a web-page) I

Re: Matlab equivalent syntax in Python

2010-11-25 Thread Tim Roberts
Akand Islam wrote: > >Can anyone please suggest me what will be the good way to use matlab >equivalent of "profile clear, profile on, profile off, profile resume >and profile viewer" in Python? Python has a number of ways of measuring elapsed time, including the "timeit" module and the "trace" mo

Re: Parsing markup.

2010-11-25 Thread Javier Collado
Hello, 2010/11/26 Joe Goldthwaite : > I’m attempting to parse some basic tagged markup. > >  Elementree and lxml seem to want a full formatted > page, not a small segment like this one. BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/) could help in the parsing: >>> from BeautifulSou

Re: Newbie subprocess question

2010-11-25 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Hugo Léveillé wrote: I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside

class in c subclasses python classes, called in python

2010-11-25 Thread alex goretoy
I'm looking to create an application that uses c++ and python together. Currently my application is all python. But need to obfuscate some of the code. I am wanting to have c++ code so I can handle encryption with it and other tasks. But first I need it to subclass some python class objects. One ta

Re: Pypi (Cheeseshop) Score - derivation of ?

2010-11-25 Thread alex23
"Martin v. Loewis" wrote: > There was indeed a kwalitee computation (cheesecake); it is unmaintained. Ah yes, I couldn't remember the particular mispelling the project used :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing markup.

2010-11-25 Thread MRAB
On 26/11/2010 03:28, Joe Goldthwaite wrote: > I’m attempting to parse some basic tagged markup. The output of the > TinyMCE editor returns a string that looks something like this; > > This is a paragraph with bold and italic elements in > itIt can be made up of multiple lines separated by pagagra

Parsing markup.

2010-11-25 Thread Joe Goldthwaite
I'm attempting to parse some basic tagged markup. The output of the TinyMCE editor returns a string that looks something like this; This is a paragraph with bold and italic elements in itIt can be made up of multiple lines separated by pagagraph tags. I'm trying to render the paragraph int

Preciseinfo collections updated http://preciseinfo.org

2010-11-25 Thread piadmin
All preciseinfo.org collections are updated. (Java, Javascript, C++ VC ATL STL, MFC VC, Python, Php) About collections: -- Collections include two types of information: 1) Code examples (guaranteed to have articles with code on the subject of selected chapter, guaranteed to b

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Raymond Hettinger
[Paul Rubin] > I'd mention the SocketServer library, except I'm not sure what you > mean by "cooperative", so I don't know if that counts. Cooperative multiple inheritance is a specific problem when there is a diamond diagram with the same method name needing to be called on multiple paths and eac

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Raymond Hettinger
On Nov 25, 3:38 pm, John Nagle wrote: >     Multiple inheritance in Python is basically what fell out of > CPython's internals, not a design.   Sorry to disagree. That is historically inaccurate. Guido designed super() on purpose. He took his cues from "Putting Metaclasses to Work" by Ira Forma

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Steven D'Aprano
On Thu, 25 Nov 2010 15:38:36 -0800, John Nagle wrote: > Part of the problem is the notion that if a base class is duplicated in > the hierarchy, there's only one copy. Why is that a problem? I would expect it to be a problem if it showed up twice. > So if you inherit from two > classes, both o

Re: what a cheap rule

2010-11-25 Thread Yingjie Lan
--- On Fri, 11/26/10, Steven D'Aprano wrote: > From: Steven D'Aprano > Subject: Re: what a cheap rule > To: python-list@python.org > Date: Friday, November 26, 2010, 5:10 AM > On Thu, 25 Nov 2010 08:15:21 -0800, > Yingjie Lan wrote: > > You seem to have misunderstood both forms of the raise >

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Mark Wooding
John Nagle writes: >Multiple inheritance in Python is basically what fell out of > CPython's internals, not a design. It's one of those areas where > order of execution matters, and that wasn't well worked out. I'm not sure about the history, but this doesn't sound right to me. > Allowing

Re: what a cheap rule

2010-11-25 Thread Steven D'Aprano
On Thu, 25 Nov 2010 08:15:21 -0800, Yingjie Lan wrote: > Intuition #1: as if you raise an exception type, and then match that > type. > It seems that no instances > are involved here (Intuitively). Your intuition is not my intuition, nor does it match what Python actually does. You can only go s

Re: tilted text in the turtle module

2010-11-25 Thread Yingjie Lan
--- On Fri, 11/26/10, Steve Holden wrote: > From: Steve Holden > Subject: Re: tilted text in the turtle module > To: python-list@python.org > Date: Friday, November 26, 2010, 4:16 AM > On 11/25/2010 5:58 PM, Yingjie Lan > wrote: > > --- On Thu, 11/25/10, Steve Holden > wrote: > >>> And even if

Re: Newbie subprocess question

2010-11-25 Thread MRAB
On 25/11/2010 22:56, Hugo Léveillé wrote: I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside doubl

Re: tilted text in the turtle module

2010-11-25 Thread Steve Holden
On 11/25/2010 5:58 PM, Yingjie Lan wrote: > --- On Thu, 11/25/10, Steve Holden wrote: >>> And even if I made a patch, >>> then how to publish it? >>> >> Once you have a patch, attach it to the issue as a file and >> try and get >> it reviewed by a developer for incorporation into a future >> rele

Re: the buggy regex in Python

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, MRAB wrote: > > > Look at the spans: > > >>> for m in re.finditer('((.d.)*)*', 'adb'): >     print(m.span()) > >     > (0, 3) > (3, 3) > > There's an non-empty match followed by an empty match. If you read my first post, it should be apparent that that the empty string

Re: tilted text in the turtle module

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, Steve Holden wrote: > > And even if I made a patch, > > then how to publish it? > > > Once you have a patch, attach it to the issue as a file and > try and get > it reviewed by a developer for incorporation into a future > release. > > Note that no Python 2.8 release is pl

Re: what a cheap rule

2010-11-25 Thread Terry Reedy
On 11/25/2010 4:12 AM, Yingjie Lan wrote: Sometimes the golden rule in Python of "explicit is better than implicit" is so cheap that it can be thrown away for the trouble of typing an empty tuple. Today when I am explaining that in Python 3, there are two ways to raise exceptions: raise Excepti

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread John Nagle
On 11/24/2010 12:08 PM, Raymond Hettinger wrote: I'm writing-up more guidance on how to use super() and would like to point at some real-world Python examples of cooperative multiple inheritance. Google searches take me to old papers for C++ and Eiffel, but that don't seem to be relevant to most

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Paul Rubin
Raymond Hettinger writes: > I'm writing-up more guidance on how to use super() and would like to > point at some real-world Python examples of cooperative multiple > inheritance. I'd mention the SocketServer library, except I'm not sure what you mean by "cooperative", so I don't know if that coun

MediaTags - exporting m4a, id3, exiv, etc as JSON

2010-11-25 Thread AJ ONeal
I'm sponsoring the development of cross-platform (C/C++) utilities for extracting a variety of media meta-data as JSON, including stream checksums and stream meta-data. git://github.com/coolaj86/mtags.git I'd like to get support for developing this, and I'm interested in the opinions of others w

Re: Arrays

2010-11-25 Thread Slie
I have an exercise im working on. I have an array of strings, and I would like to take each peace of the array and assign it to a new array so I can iterate over each of those pieces and replace the sting I want then put it back together. I hope that is not too confusing. This is how im trying

MediaTags - exporting m4a, id3, exiv, etc as JSON (YAML)

2010-11-25 Thread AJ ONeal
I'm sponsoring the development of cross-platform (C/C++) utilities for extracting a variety of media meta-data as JSON, including stream checksums and stream meta-data. git://github.com/coolaj86/mtags.git I'd like to get support for developing this, and I'm interested in the opinions of others w

Re: Newbie subprocess question

2010-11-25 Thread Tim Harig
On 2010-11-25, Hugo Léveillé wrote: > I'm starting various application using subprocess.Popen without any > problem. The problem is with application inside "Program Files". It > looks like subprocess is stopping the application string after > "Program". I tried puting the programe name inside doub

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Aahz
In article <89b6d53f-dcdc-4442-957f-1f4d29115...@n32g2000pre.googlegroups.com>, Raymond Hettinger wrote: > >I'm writing-up more guidance on how to use super() and would like to >point at some real-world Python examples of cooperative multiple >inheritance. My previous job used this rather heavil

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Steve Holden
On 11/25/2010 4:40 PM, Raymond Hettinger wrote: > It's hard to write a best practices document for super() when > the doesn't appear to be any practice at all :-) > Sounds like the Python community have voted with their feet. I seem to remember that Alex Martelli's "Python in a Nutshell" contains

Newbie subprocess question

2010-11-25 Thread Hugo Léveillé
I'm starting various application using subprocess.Popen without any problem. The problem is with application inside "Program Files". It looks like subprocess is stopping the application string after "Program". I tried puting the programe name inside double quote like '"Program File*..."'. No luck.

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Raymond Hettinger
On Nov 24, 9:16 pm, Alice Bevan–McGregor wrote: > On 2010-11-24 12:08:04 -0800, Raymond Hettinger said: > > > I'm writing-up more guidance on how to use super() and would like to > > point at some real-world Python examples of cooperative multiple > > inheritance. > > The SocketServer module > (ht

Re: inverse of a matrix with Fraction entries

2010-11-25 Thread Daniel Fetchinson
>> > I wouldn't do it that way. Let M be your matrix. Work out the LCM l of >> > the denominators, and multiply the matrix by that to make it an integer >> > matrix N = l M. Then work out the determinant d of that integer matrix. >> > Next, the big step: use Gaussian elimination to find a matrix

Re: inverse of a matrix with Fraction entries

2010-11-25 Thread Mark Wooding
Daniel Fetchinson writes: > > I wouldn't do it that way. Let M be your matrix. Work out the LCM l of > > the denominators, and multiply the matrix by that to make it an integer > > matrix N = l M. Then work out the determinant d of that integer matrix. > > Next, the big step: use Gaussian elim

Re: a story of a top expert of Mathematica: Robby Villegas

2010-11-25 Thread small Pox
On Nov 25, 2:10 am, Xah Lee wrote: > On Nov 24, 2:02 pm, Xah Lee wrote: > > > just learned that one of my best friend, one of world's top expert of > > the Mathematica language, died, last month. > > > • 〈Robby Villegas Died > > (1968-2010)〉http://xahlee.org/math/Robby_Villegas.html > > so, appa

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread MRAB
On 25/11/2010 19:57, Phlip wrote: Accepting input from a human is fraught with dangers and edge cases. Here's a non-regex solution Thanks all for playing! And as usual I forgot a critical detail: I'm writing a matcher for a Morelia /viridis/ Scenario step, so the matcher must be a single re

Re: building a web interface

2010-11-25 Thread Shel
Will take a look after stuffing myself with turkey today (am in the US, where we give thanks by eating everything in sight). Thanks, Alice. Wait, did I just say "thanks"? Must go eat pie. On Nov 25, 12:36 am, Alice Bevan–McGregor wrote: > Howdy! > > I'm mildly biased, being the author of the f

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Phlip
> Accepting input from a human is fraught with dangers and edge cases. > Here's a non-regex solution Thanks all for playing! And as usual I forgot a critical detail: I'm writing a matcher for a Morelia /viridis/ Scenario step, so the matcher must be a single regexp. http://c2.com/cgi/wiki?Mor

Automatic Distutils generator

2010-11-25 Thread macm
Hi Folks I am trying run Distutils setup inside a script. The Docs dont tell me much and I cant find any examples. This script will generate shared libraries recursive to all files in a dir. - import os import sys from distutils.core import setup as d from distutil

Re: Scheme as a virtual machine?

2010-11-25 Thread namekuseijin
On 25 nov, 14:30, m_mom...@yahoo.com (Mario S. Mommer) wrote: > Raffael Cavallaro > writes: > > > On 2010-11-24 16:19:49 -0500, toby said: > > >> And furthermore, he has cooties. > > > Once again, not all ad hominem arguments are ad hominem > > fallacies. Financial conflict of interest is a prime

Re: SQLite date fields

2010-11-25 Thread CM
> However, when it comes to writing-back data to the table, SQLite is very > forgiving and is quite happy to store '25/06/2003' in a date field, but > this is not ideal because a) I could be left with a mixture of date > formats in the same column,  b) SQLite's date functions only work with > ISO f

Re: regexp matching end of line or comma

2010-11-25 Thread Saul Spatz
On Nov 25, 8:40 am, Jean-Michel Pichavant wrote: > Hy guys, > > I'm struggling matching patterns ending with a comma ',' or an end of > line '$'. > > import re > > ex1 = 'sumthin,' > ex2 = 'sumthin' > m1 = re.match('(?P\S+),', ex1) > m2 = re.match('(?P\S+)$', ex2) > m3 = re.match('(?P\S+)[,$]', ex

Re: tilted text in the turtle module

2010-11-25 Thread Steve Holden
On 11/25/2010 10:49 AM, Yingjie Lan wrote: > --- On Thu, 11/25/10, Steve Holden wrote: >> From: Steve Holden >> Subject: Re: tilted text in the turtle module >> To: python-list@python.org >> Date: Thursday, November 25, 2010, 7:00 PM >> On 11/25/2010 5:06 AM, Yingjie Lan >> wrote: >> This sounds

Re: do something every n seconds

2010-11-25 Thread km
while True: time.sleep(10) print('hello python!') HTH, KM On Thu, Nov 25, 2010 at 8:35 PM, Steve Holden wrote: > On 11/25/2010 6:38 AM, Santiago Caracol wrote >> Hello, >> >> how can I do something (e.g. check if new files are in the working >> directory) every n seconds in Python? >> > Loo

Re: what a cheap rule

2010-11-25 Thread Steve Holden
On 11/25/2010 10:15 AM, Yingjie Lan wrote: > As I am thinking about it, it seems two > conflicting intuition of code comprehension > are at work here: > > Intuition #1: as if you raise an exception > type, and then match that type. > It seems that no instances > are involved here (Intuitively). >

Re: the buggy regex in Python

2010-11-25 Thread MRAB
On 25/11/2010 16:44, Yingjie Lan wrote: --- On Thu, 11/25/10, MRAB wrote: re.findall performs multiple searches, each starting where the previous one finished. The first match started at the start of the string and finished at its end. The second match started at that point (the end of the stri

Re: regexp matching end of line or comma

2010-11-25 Thread MRAB
On 25/11/2010 16:26, Jean-Michel Pichavant wrote: MRAB wrote: On 25/11/2010 14:40, Jean-Michel Pichavant wrote: Hy guys, I'm struggling matching patterns ending with a comma ',' or an end of line '$'. import re ex1 = 'sumthin,' ex2 = 'sumthin' m1 = re.match('(?P\S+),', ex1) m2 = re.match('(?

Re: Scheme as a virtual machine?

2010-11-25 Thread Mario S. Mommer
Raffael Cavallaro writes: > On 2010-11-24 16:19:49 -0500, toby said: > >> And furthermore, he has cooties. > > Once again, not all ad hominem arguments are ad hominem > fallacies. Financial conflict of interest is a prime example of a > perfectly valid ad hominem argument. It has limited validit

Re: tilted text in the turtle module

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, Steve Holden wrote: > From: Steve Holden > Subject: Re: tilted text in the turtle module > To: python-list@python.org > Date: Thursday, November 25, 2010, 7:00 PM > On 11/25/2010 5:06 AM, Yingjie Lan > wrote: > This sounds like a good idea. To request a feature you > should

Re: the buggy regex in Python

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, MRAB wrote: > re.findall performs multiple searches, each starting where > the previous > one finished. The first match started at the start of the > string and > finished at its end. The second match started at that point > (the end of > the string) and found another match,

Re: the buggy regex in Python

2010-11-25 Thread MRAB
On 25/11/2010 11:32, Yingjie Lan wrote: I know many experts will say I don't have understanding...but let me pay this up front as my tuition. Here are some puzzling results I have got (I am using Python 3, I suppose similar results for python 2). When I do the following, I got an exception:

Re: regexp matching end of line or comma

2010-11-25 Thread Jean-Michel Pichavant
MRAB wrote: On 25/11/2010 14:40, Jean-Michel Pichavant wrote: Hy guys, I'm struggling matching patterns ending with a comma ',' or an end of line '$'. import re ex1 = 'sumthin,' ex2 = 'sumthin' m1 = re.match('(?P\S+),', ex1) m2 = re.match('(?P\S+)$', ex2) m3 = re.match('(?P\S+)[,$]', ex1) m4

Re: what a cheap rule

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, Steve Holden wrote: > > Sometimes the golden rule in Python of > > "explicit is better than implicit" is > > so cheap that it can be thrown away > > for the trouble of typing an empty tuple. > > > I'm not sure that there *are* any golden rules. The "Zen of > Python" is > inte

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread MRAB
On 25/11/2010 04:46, Phlip wrote: HypoNt: I need to turn a human-readable list into a list(): print re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c').groups() That currently returns ('c',). I'm trying to match "any word \w+ followed by a comma, or a final word preceded by and.

Re: Scheme as a virtual machine?

2010-11-25 Thread namekuseijin
On 25 nov, 09:23, Elena wrote: > On Oct 13, 9:09 pm, namekuseijin wrote: > > > > > > > On 11 out, 08:49, Oleg  Parashchenko wrote: > > > > Hello, > > > > I'd like to try the idea that Scheme can be considered as a new > > > portable assembler. We could code something in Scheme and then compile >

Re: regexp matching end of line or comma

2010-11-25 Thread MRAB
On 25/11/2010 14:40, Jean-Michel Pichavant wrote: Hy guys, I'm struggling matching patterns ending with a comma ',' or an end of line '$'. import re ex1 = 'sumthin,' ex2 = 'sumthin' m1 = re.match('(?P\S+),', ex1) m2 = re.match('(?P\S+)$', ex2) m3 = re.match('(?P\S+)[,$]', ex1) m4 = re.match('(

Re: regexp matching end of line or comma

2010-11-25 Thread Sol Toure
Try this: '(?P\S+)(,|$)' On Thu, Nov 25, 2010 at 9:40 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Hy guys, > > I'm struggling matching patterns ending with a comma ',' or an end of line > '$'. > > import re > > ex1 = 'sumthin,' > ex2 = 'sumthin' > m1 = re.match('(?P\S+),', ex1) >

Re: Scheme as a virtual machine?

2010-11-25 Thread Raffael Cavallaro
On 2010-11-24 16:19:49 -0500, toby said: And furthermore, he has cooties. Once again, not all ad hominem arguments are ad hominem fallacies. Financial conflict of interest is a prime example of a perfectly valid ad hominem argument. People who parse patterns but not semantics are apt to fa

Re: SQLite date fields

2010-11-25 Thread MRAB
On 25/11/2010 00:45, Alan Harris-Reid wrote: Hi, I am having design problems with date storage/retrieval using Python and SQLite. I understand that a SQLite date column stores dates as text in ISO format (ie. '2010-05-25'). So when I display a British date (eg. on a web-page) I convert the dat

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Steve Holden
On 11/24/2010 10:46 PM, Phlip wrote: > HypoNt: > > I need to turn a human-readable list into a list(): > >print re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and > c').groups() > > That currently returns ('c',). I'm trying to match "any word \w+ > followed by a comma, or a final wor

Re: do something every n seconds

2010-11-25 Thread Steve Holden
On 11/25/2010 6:38 AM, Santiago Caracol wrote: > Hello, > > how can I do something (e.g. check if new files are in the working > directory) every n seconds in Python? > Look at the sched library, which was written to take care of requirements like this. Use time.sleep() as your delay function and

Re: tilted text in the turtle module

2010-11-25 Thread Steve Holden
On 11/25/2010 5:06 AM, Yingjie Lan wrote: > First of all, I'd like to express my deep gratidute to the author of this > module, it is such a fun module to work with and to teach python as a first > programming language. > > Secondly, I would like to request a feature if it is not too hard to ach

Re: what a cheap rule

2010-11-25 Thread Steve Holden
On 11/25/2010 3:12 AM, Yingjie Lan wrote: > Sometimes the golden rule in Python of > "explicit is better than implicit" is > so cheap that it can be thrown away > for the trouble of typing an empty tuple. > I'm not sure that there *are* any golden rules. The "Zen of Python" is intended to be guide

regexp matching end of line or comma

2010-11-25 Thread Jean-Michel Pichavant
Hy guys, I'm struggling matching patterns ending with a comma ',' or an end of line '$'. import re ex1 = 'sumthin,' ex2 = 'sumthin' m1 = re.match('(?P\S+),', ex1) m2 = re.match('(?P\S+)$', ex2) m3 = re.match('(?P\S+)[,$]', ex1) m4 = re.match('(?P\S+)[,$]', ex2) print m1, m2 print m3 print m4

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread python
Phlip, > I'm trying to match "any word \w+ followed by a comma, or a final word > preceded by and." Here's a non-regex solution that handles multi-word values and multiple instances of 'and' (as pointed out by Alice). The posted code could be simplified via list comprehension - I chose the more

Re: do something every n seconds

2010-11-25 Thread Adam Tauno Williams
On Thu, 2010-11-25 at 04:38 -0800, Santiago Caracol wrote: > how can I do something (e.g. check if new files are in the working > directory) every n seconds in Python? Use the Python Advanced Scheduler in your application - it is a great little module. Then you've solved every 'scheduler' issue

Re: do something every n seconds

2010-11-25 Thread Stefan Sonnenberg-Carstens
Windows or UNIX ? Am Do, 25.11.2010, 13:38 schrieb Santiago Caracol: > Hello, > > how can I do something (e.g. check if new files are in the working > directory) every n seconds in Python? > > Santiago > -- > http://mail.python.org/mailman/listinfo/python-list > > -- MfG, Stefan Sonnenberg-Car

Re: do something every n seconds

2010-11-25 Thread Paul Rubin
Santiago Caracol writes: > how can I do something (e.g. check if new files are in the working > directory) every n seconds in Python? Don't do it that way if you can help it. Use inotify or the equivalent instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: do something every n seconds

2010-11-25 Thread Alice Bevan–McGregor
how can I do something (e.g. check if new files are in the working directory) every n seconds in Python? The simplest method is executing time.sleep(n) within an infinite while loop. There are more elegant solutions: using coroutine frameworks, threaded task schedulers, etc. — Alice

do something every n seconds

2010-11-25 Thread Santiago Caracol
Hello, how can I do something (e.g. check if new files are in the working directory) every n seconds in Python? Santiago -- http://mail.python.org/mailman/listinfo/python-list

the buggy regex in Python

2010-11-25 Thread Yingjie Lan
I know many experts will say I don't have understanding...but let me pay this up front as my tuition. Here are some puzzling results I have got (I am using Python 3, I suppose similar results for python 2). When I do the following, I got an exception: >>> re.findall('(d*)*', 'adb') >>> re.finda

Re: Scheme as a virtual machine?

2010-11-25 Thread Elena
On Oct 13, 9:09 pm, namekuseijin wrote: > On 11 out, 08:49, Oleg  Parashchenko wrote: > > > > > Hello, > > > I'd like to try the idea that Scheme can be considered as a new > > portable assembler. We could code something in Scheme and then compile > > it to PHP or Python or Java or whatever. > >

tilted text in the turtle module

2010-11-25 Thread Yingjie Lan
First of all, I'd like to express my deep gratidute to the author of this module, it is such a fun module to work with and to teach python as a first programming language. Secondly, I would like to request a feature if it is not too hard to achieve. Currently, you can only write texts horizonta

Re: AIX 5.3 - Enabling Shared Library Support Vs Extensions

2010-11-25 Thread Stefan Krah
Anurag Chourasia wrote: > When I configure python to enable shared libraries, none of the extensions > are getting built during the make step due to this error. > > building 'cStringIO' extension > gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes -I. -I

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Alice Bevan–McGregor
Now that I think about it, and can be stripped using a callback function as the 'normalize' argument to my KeywordProcessor class: def normalize(value): value = value.strip() if value.startswith("and"): value = value[3:] return value parser = KeywordProcessor(',', normalize=no

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-25 Thread Alice Bevan–McGregor
Accepting input from a human is frought with dangers and edge cases. ;) Some time ago I wrote a regular expression generator that creates regexen that can parse arbitrarily delimited text, supports quoting (to avoid accidentally separating two elements that should be treated as one), and work

Re: Processing file with lists.

2010-11-25 Thread Alice Bevan–McGregor
You describe a two-part problem. The first, loading the data, is easily accomplished with the Python CSV module: http://docs.python.org/library/csv.html e.g.: reader = csv.reader(open('filename', 'rb'), delimiter=';', quotechar=None) In the above example, you can iterate over 'reade

Processing file with lists.

2010-11-25 Thread Geobird
I have a text file , having fields delimited by ; in the first line and all the way down is the data taken for those fields . Say FAMILY NAME;SPECIES/SUBSPECIES;GENUS NAME;SUBGENUS NAME;SPECIES NAME;SUBSPECIES NAME;AUTHORSHIP Acrididae;Acanthacris ruficornis (Fabricius, 1787);Acanthacris;;r

Re: a regexp riddle: re.search(r'

2010-11-25 Thread Yingjie Lan
--- On Thu, 11/25/10, Phlip wrote: > From: Phlip > Subject: a regexp riddle: re.search(r' > To: python-list@python.org > Date: Thursday, November 25, 2010, 8:46 AM > HypoNt: > > I need to turn a human-readable list into a list(): > >    print re.search(r'(?:(\w+), |and > (\w+))+', 'whatever a,

AIX 5.3 - Enabling Shared Library Support Vs Extensions

2010-11-25 Thread Anurag Chourasia
All, When I configure python to enable shared libraries, none of the extensions are getting built during the make step due to this error. building 'cStringIO' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/u01/home/apli/wm/GDD/Python-2.

Re: Pypi (Cheeseshop) Score - derivation of ?

2010-11-25 Thread Martin v. Loewis
> Occurrence of search term weighted by field (name, summary, keywords, > description, author, maintainer) > > I thought PyPI used to offer a 'kwality' score for packages, based on > the presence of installers, doc files, tests etc. Does anyone know > what happened to that? There was indeed a kwa

what a cheap rule

2010-11-25 Thread Yingjie Lan
Sometimes the golden rule in Python of "explicit is better than implicit" is so cheap that it can be thrown away for the trouble of typing an empty tuple. Today when I am explaining that in Python 3, there are two ways to raise exceptions: raise Exception raise Exception() and that the first on

Re: building a web interface

2010-11-25 Thread Alice Bevan–McGregor
Howdy! I'm mildly biased, being the author of the framework, but I can highly recommend WebCore for rapid prototyping of web applications; it has templating via numerous template engines, excellent JSON (AJAJ) support, and support for database back-ends via SQLAlchemy. It also has session su

Re: building a web interface

2010-11-25 Thread Shel
This is really great. I wish I could come up with some creative new ways to say thank you, but... thank you :-) Shel On Nov 21, 6:10 pm, Martin Gregorie wrote: > On Sun, 21 Nov 2010 15:40:10 -0800, Shel wrote: > > I am confused about multiple simultaneous users, which I would like to > > be able

[ANN] PythonWebkit bindings for WebkitDFB

2010-11-25 Thread Luke Kenneth Casson Leighton
WebkitDFB is an experimental port to allow the webkit web browser engine to use DirectFB (http://directfb.org). It is lightning-quick to start up (no large widget set to load), yet has the potential to provide full HTML5 functionality. The PythonWebkit project, http://www.gnu.org/software/pythonw