Re: inspect.stack() performance

2009-08-12 Thread Gabriel Genellina
En Thu, 06 Aug 2009 09:00:45 -0300, Doron Tal escribió: I use inspect.stack() to extract some info, such as file name, function name and line number, for the sake of logging (home brew logger). I tested to see how much time it takes to execute the command: Python 2.4.3 (#1, Jan 21 2009, 01

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Jean-Michel Pichavant
Esmail wrote: shaileshkumar wrote: Hello, EPYDOC is very good for automatic generation of documentation from source code. You may also consider Sphinx http://sphinx.pocoo.org/ which is used for many projects including the official Python documentation, documentation of Zope (http://docs.zope.o

Re: How to page output in >>> ?

2009-08-12 Thread Gabriel Genellina
En Wed, 12 Aug 2009 18:41:38 -0300, kj escribió: How does one tell the python interactive interpreter to run the next output to stdout through the default pager? Basically, I'm looking for Python's equivalent of Perl's debugger's "|" prefix, as in DB<1> |print $long_output Try using pydoc

Re: How to find out in which module an instance of a class is created?

2009-08-12 Thread Gabriel Genellina
En Mon, 10 Aug 2009 18:51:59 -0300, Johannes Janssen escribió: class A(object): def __init__(self, mod=None): if mod is None: self.mod = sys._getframe(1).f_globals['__name__'] else: self.mod = mod In warnings.warn() they used try around sys._getfra

Re: Need feedback on ORF-extracting code

2009-08-12 Thread Terry Reedy
gb345 wrote: Hi everyone. I'm relatively new to Python, and could use your feedback on the code below. First some nomenclature. A "nucleotide" is one of A, C, G, T, or U. (In practice, a sequence of such nucleotides never contains both T and U, but this fact is not important in what follows.

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Terry Reedy
Paul Boddie wrote: Right, but those good points are still worth taking on board. There have been Xah Lee posts which have been relatively constructive, The last time that he did do so that I read, I responded rationally like I would with any other normal post. He responded with foul insults.

Re: Format Code Repeat Counts?

2009-08-12 Thread Gabriel Genellina
En Wed, 12 Aug 2009 19:23:32 -0300, Chris Rebert escribió: On Wed, Aug 12, 2009 at 4:34 PM, jschwab wrote: As a more concrete example, say I have several sets of letters in a list of strings     letters = ["aeiou", "hnopty", "egs", "amsp"] and I wanted to build a regular expression string o

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Terry Reedy
Raymond Hettinger wrote: On Aug 12, 3:32 am, Paul Boddie wrote: Maybe the problem is that although everyone welcomes contributions and changes (or says that they do), the mechanisms remain largely beyond criticism. FWIW, I support the idea the regular docs incorporating links to freely editab

Re: fileinput

2009-08-12 Thread Gabriel Genellina
En Wed, 12 Aug 2009 01:27:47 -0300, naaman escribió: I'm writing my first Python script and I want to use fileinput to open a file in r+ mode. Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. ANy ideas? Don't use fileinput, it can't handle r+, only sequencial access. Even if you

Re: Nice copy in interactive terminal

2009-08-12 Thread Chris Rebert
On Thu, Aug 13, 2009 at 12:15 AM, casebash wrote: > Hello fellow Python Users, > > I've been wondering for a while if there exists an interactive > terminal which has nice copy feature (ie. I can copy code without > getting the >>> in front of every line). Not quite answering your exact question,

Re: getting a "simple" program to work

2009-08-12 Thread John Haggerty
Just checking to see if this is more adequate to what you would have wanted to see I didn't get any feedback so I wasn't quite sure of this at the present time. On Tue, Aug 11, 2009 at 11:02 PM, John Haggerty wrote: > > > On Tue, Aug 11, 2009 at 10:46 PM, Chris Rebert wrote: > >> On Sun, Aug 9,

Re: Changing Remote Registry

2009-08-12 Thread Gabriel Genellina
En Mon, 10 Aug 2009 09:47:19 -0300, Kevin Holleran escribió: On Fri, Aug 7, 2009 at 2:08 PM, Tim Golden wrote: Kevin Holleran wrote: hKey = _winreg.OpenKey (keyPath, path, 0, _winreg.KEY_SET_VALUE) value,type = _winreg.QueryValueEx(hKey, item) if (value == wrongValue): _winreg.SetValu

Re: How to launch a function at regular time intervals ?

2009-08-12 Thread Frank Millman
On Aug 12, 11:09 pm, David wrote: > Hi all, I'm trying to launch a function at regular time intervals but > cannot find the way to do it. I assume you want your main program to continue running, while launching the function to run in the background. If you need this as a general capability, Ch

Nice copy in interactive terminal

2009-08-12 Thread casebash
Hello fellow Python Users, I've been wondering for a while if there exists an interactive terminal which has nice copy feature (ie. I can copy code without getting the >>> in front of every line). Thanks, Chris PS. apologies if I am posting this in the wrong group. I am unsure of the exact scop

Re: Scraping Wikipedia with Python

2009-08-12 Thread Paul Rubin
Dotan Cohen writes: > > maybe you want dbpedia. > I did not know about this. Thanks! You might also like freebase/metaweb. -- http://mail.python.org/mailman/listinfo/python-list

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread rurpy
On 08/12/2009 01:58 AM, Steven D'Aprano wrote: > On Tue, 11 Aug 2009 14:50:51 -0700, rurpy wrote: > The issue tracker is fine for many things, but the process it provides is equivalent to peep-hole optimization. How does one submit a tracker issue for something like the overall orga

Re: csv.DictWriter.write_header()

2009-08-12 Thread Alan G Isaac
> On Aug 13, 6:45 am, Alan G Isaac wrote: >> Given a csv.DictWriter instance `dw` >> I think it would be nice to be able to >> say dw.write_header() >> instead of >> dw.writer.writerow(dw.fieldnames) >> >> Good idea? On 8/12/2009 10:24 PM John Machin apparently wrote: > Yes, it's a brilliant ide

Re: Write binary data to standard error?

2009-08-12 Thread Saptarshi
On Aug 12, 10:32 pm, sapsi wrote: > Hello, > This is probably a basic question, but how does one write binary data > to standard error e.g int as network order (4 bytes)? > > Much thanks > Saptarshi Solved: import sys import os from struct import * d=os.fdopen(sys.stderr.fileno(),"wb") d.write("

Write binary data to standard error?

2009-08-12 Thread sapsi
Hello, This is probably a basic question, but how does one write binary data to standard error e.g int as network order (4 bytes)? Much thanks Saptarshi -- http://mail.python.org/mailman/listinfo/python-list

Re: csv.DictWriter.write_header()

2009-08-12 Thread John Machin
On Aug 13, 6:45 am, Alan G Isaac wrote: > Given a csv.DictWriter instance `dw` > I think it would be nice to be able to > say dw.write_header() > instead of > dw.writer.writerow(dw.fieldnames) > > Good idea? Yes, it's a brilliant idea. All you have to do is insert the following lines in your code

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Cousin Stanley
> FWIW, I support the idea the regular docs incorporating links > to freely editable wiki pages. That will at least make it > easier for people to make changes or add notes. > > That being said, I would like to add a few thoughts about the > current process. ISTM that important corrections (

Re: run all scripts in sub-directory as subroutines?

2009-08-12 Thread ryles
On Aug 11, 5:12 pm, guthrie wrote: > This works fine, but in the sub-modules the sys.path appropriately > returns the same as from the parent, I want them to know their own > file names. How?? I can pass it to them, but wondered if there is a > more self-sufficient way for a module to know from wh

Re: fileinput

2009-08-12 Thread naaman
On Aug 12, 1:35 pm, Dave Angel wrote: > naaman wrote: > > I'm writing my first Python script and > > I want to use fileinput to open a file in r+ mode. > > Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. > > ANy ideas? > > > Need to find and overwrite a line in a file several times.

Re: httplib incredibly slow :-(

2009-08-12 Thread David Robinow
On Wed, Aug 12, 2009 at 12:37 PM, Chris Withers wrote: > David Stanek wrote: >> Also on the same box where you run this script >> can you test with curl or wget? > It's a Windows box, so no :-( Why not? http://users.ugent.be/~bpuype/wget/ http://curl.haxx.se/download.html -- http://mail.python.o

Re: How to launch a function at regular time intervals ?

2009-08-12 Thread Dave Angel
David wrote: Hi all, I'm trying to launch a function at regular time intervals but cannot find the way to do it. Here is the code I wrote (time_interval is a user defined variable in seconds): while(1) timestamp=datetime.now() timestamp_seconds=timestamp.hour*3600+timestamp.minute*60+timesta

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread MRAB
Steven D'Aprano wrote: On Wed, 12 Aug 2009 14:21:34 -0700, Douglas Alan wrote: On Aug 12, 5:32 am, Steven D'Aprano wrote: That problem basically boils down to a deep-seated philosophical disagreement over which philosophy a language should follow in regard to backslash escapes: "Anything no

Re: matching patterns after regex?

2009-08-12 Thread Martin
On Aug 12, 10:29 pm, Mark Lawrence wrote: > Bernard wrote: > > On 12 août, 12:43, Martin wrote: > >> On Aug 12, 1:42 pm, Martin wrote: > > >>> On Aug 12, 1:23 pm, Steven D'Aprano >>> cybersource.com.au> wrote: > On Wed, 12 Aug 2009 05:12:22 -0700, Martin wrote: > > I tried > > re.f

Re: How to page output in >>> ?

2009-08-12 Thread Nobody
On Wed, 12 Aug 2009 21:41:38 +, kj wrote: > How does one tell the python interactive interpreter to run the > next output to stdout through the default pager? Basically, I'm > looking for Python's equivalent of Perl's debugger's "|" prefix, > as in > > DB<1> |print $long_output Something

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 14:21:34 -0700, Douglas Alan wrote: > On Aug 12, 5:32 am, Steven D'Aprano > wrote: > >> That problem basically boils down to a deep-seated philosophical >> disagreement over which philosophy a language should follow in regard >> to backslash escapes: >> >> "Anything not expli

Need feedback on ORF-extracting code

2009-08-12 Thread gb345
Hi everyone. I'm relatively new to Python, and could use your feedback on the code below. First some nomenclature. A "nucleotide" is one of A, C, G, T, or U. (In practice, a sequence of such nucleotides never contains both T and U, but this fact is not important in what follows.) A "codon" i

Re: Format Code Repeat Counts?

2009-08-12 Thread Emile van Sebille
On 8/12/2009 1:34 PM jschwab said... Are repeat counts supported Python's str.format() in some fashion? In Fortran my format strings can have repeat counts. write(*, fmt="3F8.3") [1, 2, 3] 1.000 2.000 3.000 I don't think printf-style format codes, which is what'd I'd previously used in

Re: Format Code Repeat Counts?

2009-08-12 Thread MRAB
Chris Rebert wrote: On Wed, Aug 12, 2009 at 4:34 PM, jschwab wrote: As a more concrete example, say I have several sets of letters in a list of strings letters = ["aeiou", "hnopty", "egs", "amsp"] and I wanted to build a regular expression string out of them like re_str <==> "[aeiou][hn

Re: Plotting Quadratic Functions, pygame

2009-08-12 Thread Jonathan Gardner
Before we get into fixing your code, let's talk about style. A lot of bugs are solved when you fix the style, and the remaining bugs are much easier to find and fix. (Comments inline) On Aug 12, 2:27 pm, Senad Ibraimoski -student-Mathematical Institute Belgrade wrote: > Hello, I'm a new guy to t

Re: Format Code Repeat Counts?

2009-08-12 Thread Chris Rebert
On Wed, Aug 12, 2009 at 4:34 PM, jschwab wrote: > As a more concrete example, say I have several sets of letters in a > list of strings >     letters = ["aeiou", "hnopty", "egs", "amsp"] > and I wanted to build a regular expression string out of them like >     re_str <==> "[aeiou][hnopty][egs][am

Re: Format Code Repeat Counts?

2009-08-12 Thread MRAB
jschwab wrote: Are repeat counts supported Python's str.format() in some fashion? In Fortran my format strings can have repeat counts. write(*, fmt="3F8.3") [1, 2, 3] 1.000 2.000 3.000 I don't think printf-style format codes, which is what'd I'd previously used in Python, allow for rep

Re: How to launch a function at regular time intervals ?

2009-08-12 Thread Bartosz Wroblewski
On Wed, 12 Aug 2009 14:09:29 -0700, David wrote: > > Hi all, I'm trying to launch a function at regular time intervals but > cannot find the way to do it. > For what it's worth, here's how I do it: ---8<--- #!/usr/bin/env python from time import sleep interval = 25 #seco

Re: How to launch a function at regular time intervals ?

2009-08-12 Thread Christian Heimes
David wrote: Has anyone run into a similar problem (and solved it) ? Yeah, here is my implementation as a perpetual timer based some cherrypy code and threading timer. import threading class PerpetualTimer(threading._Timer): """A subclass of threading._Timer whose run() method repeats.

Re: httplib incredibly slow :-(

2009-08-12 Thread i3dmaster
On Aug 12, 9:37 am, Chris Withers wrote: > David Stanek wrote: > > I tried to reproduce this, but I could not. Could you paste in the > > output of your script? > > Not sure how that'll help, but sure: > > 2009-08-11 21:27:59.153000 > request: 0:00:00.109000 > response: 0:00:00.109000 > read: 0:24

How to page output in >>> ?

2009-08-12 Thread kj
How does one tell the python interactive interpreter to run the next output to stdout through the default pager? Basically, I'm looking for Python's equivalent of Perl's debugger's "|" prefix, as in DB<1> |print $long_output TIA! kynn -- http://mail.python.org/mailman/listinfo/python-list

Plotting Quadratic Functions, pygame

2009-08-12 Thread Senad Ibraimoski -student-Mathematical Institute Belgrade
Hello, I'm a new guy to this group, my professor recommend this group to me, because I was boring him with questions.I'm new to python, and I have problem plotting Quadratic Functions. Using module pygame. Here is the code: #!/usr/bin/env python import pygame def main(): import sys

Re: matching patterns after regex?

2009-08-12 Thread Mark Lawrence
Bernard wrote: On 12 août, 12:43, Martin wrote: On Aug 12, 1:42 pm, Martin wrote: On Aug 12, 1:23 pm, Steven D'Aprano wrote: On Wed, 12 Aug 2009 05:12:22 -0700, Martin wrote: I tried re.findall((\w+COORDINATE).*\s+VALUE\s+=\s([\d\.\w-]+),s) You need to put quotes around strings. In t

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Raymond Hettinger
[Raymond Hettinger] > Here are a few thoughts on list.sort() for those who are interested: After one more reading of Xah Lee's posts on the documentation for sort, here are couple more thoughts: * The reason that list.sort() allows None for the cmp parameter is not so that you can write list.sort

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 5:32 am, Steven D'Aprano wrote: > That problem basically boils down to a deep-seated > philosophical disagreement over which philosophy a > language should follow in regard to backslash escapes: > > "Anything not explicitly permitted is forbidden" > > versus > > "Anything not explicitl

How to launch a function at regular time intervals ?

2009-08-12 Thread David
Hi all, I'm trying to launch a function at regular time intervals but cannot find the way to do it. Here is the code I wrote (time_interval is a user defined variable in seconds): while(1) timestamp=datetime.now() timestamp_seconds=timestamp.hour*3600+timestamp.minute*60+timestamp.second if

Re: Extending embedded python-can extensions be local to a dictionary?

2009-08-12 Thread Carl Banks
On Aug 12, 12:44 pm, Michael Kohout wrote: > Hello all- > > I've got a multithreaded server-based application that I'd like to use > python to provide plugin support for.  At execution time I would like > each call to the plugin/plugins to have their own implementation of > these extension methods

Re: matching patterns after regex?

2009-08-12 Thread Bernard
On 12 août, 12:43, Martin wrote: > On Aug 12, 1:42 pm, Martin wrote: > > > > > > > On Aug 12, 1:23 pm, Steven D'Aprano > > cybersource.com.au> wrote: > > > On Wed, 12 Aug 2009 05:12:22 -0700, Martin wrote: > > > > I tried > > > > > re.findall((\w+COORDINATE).*\s+VALUE\s+=\s([\d\.\w-]+),s) > > >

csv.DictWriter.write_header()

2009-08-12 Thread Alan G Isaac
Given a csv.DictWriter instance `dw` I think it would be nice to be able to say dw.write_header() instead of dw.writer.writerow(dw.fieldnames) Good idea? Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Format Code Repeat Counts?

2009-08-12 Thread jschwab
Are repeat counts supported Python's str.format() in some fashion? In Fortran my format strings can have repeat counts. write(*, fmt="3F8.3") [1, 2, 3] 1.000 2.000 3.000 I don't think printf-style format codes, which is what'd I'd previously used in Python, allow for repeat counts. As a

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread r
On Aug 12, 1:27 pm, Raymond Hettinger wrote: (snip) > * Many doc requests come from people just learning the language > (that makes sense because the learning process involves reading > the docs).  Unfortunately, a fair number of those requests are > flat-out wrong or represent a profound misunder

Extending embedded python-can extensions be local to a dictionary?

2009-08-12 Thread Michael Kohout
Hello all- I've got a multithreaded server-based application that I'd like to use python to provide plugin support for. At execution time I would like each call to the plugin/plugins to have their own implementation of these extension methods. Looking at http://docs.python.org/extending/embeddi

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Raymond Hettinger
[Xah Lee] > i've wrote several articles about this issue, total time spend on this > is probably more than 2 months full-time work. See: > > • Python Documentation Problems >  http://xahlee.org/perl-python/python_doc_index.html I just read you post. You did devote a substantial amount of time

Re: hashability

2009-08-12 Thread Carl Banks
On Aug 12, 10:37 am, James Stroud wrote: > Steven D'Aprano wrote: > > Well there you go -- why on earth would you prohibit None as a dictionary > > key??? That's a serious failure. > > roentgen 1% python > Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) > [GCC 3.4.2] on linux2 > Type "help", "copyri

Re: SQLObject 0.11.0

2009-08-12 Thread Daniel Fetchinson
> I don't want to start a flame war and would just like some information > before diving in-- > What are some the advantages and disadvantages of SQLObject compared to > SQLAlchemy? In short: sqlobject is much simpler (to use, to understand, etc) than sqlalchemy and so I prefer it in small project

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Raymond Hettinger
On Aug 12, 3:32 am, Paul Boddie wrote: > Maybe the problem is that although everyone welcomes contributions and > changes (or says that they do), the mechanisms remain largely beyond > criticism. FWIW, I support the idea the regular docs incorporating links to freely editable wiki pages. That wi

Pulling arrays from database for plotting

2009-08-12 Thread Kurt Schwehr
Hi all, What's the best way to pull arrays from a database for plotting? Right now, this is what I do, but can it be done simpler / more efficiently? ipython -pylab import sqlite3 cx = sqlite3.connect('20080407.decimated.db3') a = array( [tuple(row) for row in cx.execute('SELECT cg_offset, delta_

Re: hashability

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 10:37:45 -0700, James Stroud wrote: > Steven D'Aprano wrote: >> Well there you go -- why on earth would you prohibit None as a >> dictionary key??? That's a serious failure. > > > roentgen 1% python > Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) [GCC 3.4.2] on linux2 > Type

Re: SQLObject 0.11.0

2009-08-12 Thread William
I don't want to start a flame war and would just like some information before diving in-- What are some the advantages and disadvantages of SQLObject compared to SQLAlchemy? Thanks, William From: Oleg Broytmann To: Python Mailing List ; Python Announce Mailin

Re: How to find all possibly overlapping matches?

2009-08-12 Thread kj
In MRAB writes: >kj wrote: >> >> re.findall finds all non-overlapping matches, but what if one wants >> all (maximal) matches, even those that overlap? >> >> All the solutions I can come up involve calling re.search iteratively, >> each time giving it a pos parameter starting just after the s

Re: hashability

2009-08-12 Thread Chris Rebert
On Wed, Aug 12, 2009 at 1:37 PM, James Stroud wrote: > Steven D'Aprano wrote: >> >> Well there you go -- why on earth would you prohibit None as a dictionary >> key??? That's a serious failure. > > > roentgen 1% python > Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) [GCC 3.4.2] on linux2 > Type "he

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 3:36 am, Steven D'Aprano wrote: > On Tue, 11 Aug 2009 13:20:52 -0700, Douglas Alan wrote: > > My "Annotated C++ Reference Manual" is packed, and surprisingly in > > Stroustrup's Third Edition, there is no mention of the issue in the > > entire 1,000 pages. But Microsoft to the rescue:

Re: hashability

2009-08-12 Thread James Stroud
Steven D'Aprano wrote: Well there you go -- why on earth would you prohibit None as a dictionary key??? That's a serious failure. roentgen 1% python Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) [GCC 3.4.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. py>

Re: fileinput

2009-08-12 Thread Dave Angel
naaman wrote: I'm writing my first Python script and I want to use fileinput to open a file in r+ mode. Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. ANy ideas? Need to find and overwrite a line in a file several times. I can do it using open and seek() etc. but was wondering if

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Mark Lawrence
Esmail wrote: Mark Lawrence wrote: Hi Mark, The docs for the constraint package look good, see http://labix.org/python-constraint and http://labix.org/doc/constraint. I think they've been produced with epydoc see http://epydoc.sourceforge.net/ Thanks for the links, I'll take a look. Any exp

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Douglas Alan
On Aug 12, 3:08 am, Steven D'Aprano wrote: > On Tue, 11 Aug 2009 14:48:24 -0700, Douglas Alan wrote: > > In any case, my argument has consistently been that Python should have > > treated undefined escape sequences consistently as fatal errors, > > A reasonable position to take. I disagree with i

Re: How to find all possibly overlapping matches?

2009-08-12 Thread MRAB
kj wrote: re.findall finds all non-overlapping matches, but what if one wants all (maximal) matches, even those that overlap? All the solutions I can come up involve calling re.search iteratively, each time giving it a pos parameter starting just after the start of the previous match. Is there

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Esmail
Mark Lawrence wrote: Hi Mark, The docs for the constraint package look good, see http://labix.org/python-constraint and http://labix.org/doc/constraint. I think they've been produced with epydoc see http://epydoc.sourceforge.net/ Thanks for the links, I'll take a look. Any experience with so

Re: httplib incredibly slow :-(

2009-08-12 Thread Chris Withers
David Stanek wrote: I tried to reproduce this, but I could not. Could you paste in the output of your script? Not sure how that'll help, but sure: 2009-08-11 21:27:59.153000 request: 0:00:00.109000 response: 0:00:00.109000 read: 0:24:31.266000 > Also on the same box where you run this script

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Ethan Furman
Paul Boddie wrote: On 12 Aug, 17:08, Steven D'Aprano wrote: It's not the people who suggest improvements to the docs that are the problem, but the ones who insist that the docs are terrible, but aren't willing to do anything but complain. Oh, and trolls like ... I hesitate to mention his name i

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Esmail
shaileshkumar wrote: Hello, EPYDOC is very good for automatic generation of documentation from source code. You may also consider Sphinx http://sphinx.pocoo.org/ which is used for many projects including the official Python documentation, documentation of Zope (http://docs.zope.org/). See the f

How to find all possibly overlapping matches?

2009-08-12 Thread kj
re.findall finds all non-overlapping matches, but what if one wants all (maximal) matches, even those that overlap? All the solutions I can come up involve calling re.search iteratively, each time giving it a pos parameter starting just after the start of the previous match. Is there a built-in

Re: httplib incredibly slow :-(

2009-08-12 Thread Chris Withers
shaileshkumar wrote: We use PyCURL on Windows. http://pycurl.sourceforge.net/ provides pre- built versions for Windows and it works out of the box. Does it include libcurl? Are these builds available for Python 2.6? Chris -- Simplistix - Content Management, Batch Processing & Python Consultin

Re: httplib incredibly slow :-(

2009-08-12 Thread Shailesh Kumar
Yes it includes libcurl. I didn't have to install it separately. I still continue to use Python 2.4. So cannot say about Python 2.6. - Shailesh On Wed, Aug 12, 2009 at 10:23 PM, Chris Withers wrote: > shaileshkumar wrote: > >> We use PyCURL on Windows. http://pycurl.sourceforge.net/ provides pre

Re: matching patterns after regex?

2009-08-12 Thread Martin
On Aug 12, 1:42 pm, Martin wrote: > On Aug 12, 1:23 pm, Steven D'Aprano > > > cybersource.com.au> wrote: > > On Wed, 12 Aug 2009 05:12:22 -0700, Martin wrote: > > > I tried > > > > re.findall((\w+COORDINATE).*\s+VALUE\s+=\s([\d\.\w-]+),s) > > > You need to put quotes around strings. > > > In this

Re: httplib incredibly slow :-(

2009-08-12 Thread Chris Withers
Max Erickson wrote: There is an httplib2 (but I don't know anything further about it...): http://code.google.com/p/httplib2/ I had a look, it uses httplib, so will likely suffer from the same problems... Calling wget or curl using a subprocess is probably as easy as it is ugly, I use the w

Mimicing an HTML form

2009-08-12 Thread Zach Hobesh
Hi all, I'm having alot of trouble automating the submitting of form. I have an HTML page that works and it looks like this: When I put valid values for the handling script an app ID, this page works. Now I'm trying to turn this same functionality into a script. Here's my code: import

Re: httplib incredibly slow :-(

2009-08-12 Thread David Stanek
On Tue, Aug 11, 2009 at 4:25 PM, Chris Withers wrote: > Hi All, > > I'm using the following script to download a 150Mb file: > > from base64 import encodestring > from httplib import HTTPConnection > from datetime import datetime > > conn = HTTPSConnection('localhost') > headers = {} > auth = 'Basi

Re: Scraping Wikipedia with Python

2009-08-12 Thread Dotan Cohen
> http://pypi.python.org/pypi?%3Aaction=search&term=wikipedia ? > Thanks, Thorsten, I will go through those. I did not know about that resource, I am not a regular coder. One more resource to add to the toolbox! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http://mail.pyth

Re: Scraping Wikipedia with Python

2009-08-12 Thread Dotan Cohen
> maybe you want dbpedia. I did not know about this. Thanks! That is the reason why I ask. This list has an unbelievable collective knowledge and I am certain that asking "how much is 2+2" would net an insightful answer that would teach me something. Thank you, Paul, and thank you to the entire

Multithreaded library for Python?

2009-08-12 Thread Robert Dailey
Hey guys, I realize the python library has multithreading support in it, but not the kind I'm really looking for. I want something like Intel's TBB, but for Python 3.1. I need to be able to spawn off "Tasks" that operate until completed and then end by themselves. I could create my own framework f

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Paul Boddie
On 12 Aug, 17:08, Steven D'Aprano wrote: > On Wed, 12 Aug 2009 06:24:18 -0700, Paul Boddie wrote: > > > What does the Python entry on Wikipedia have to do with editing the > > Python documentation in a Wiki? > > Good question. I was responding to you mentioning Wikipedia as a possible > role model

Re: Need cleanup advice for multiline string

2009-08-12 Thread David Bolen
Robert Dailey writes: > Hey guys. Being a C++ programmer, I like to keep variable definitions > close to the location in which they will be used. This improves > readability in many ways. However, when I have a multi-line string > definition at function level scope, things get tricky because of t

Re: Need cleanup advice for multiline string

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 08:11:43 -0700, Simon Forman wrote: [quoting Robert Dailey] >> I cannot completely doubt that there are logical >> women out there. I just haven't seen one yet. But that doesn't mean I'm >> a sexist. > > Oh my. And you were doing so well. You haven't seen a logical woman? >

Re: Programming by Contract

2009-08-12 Thread shaileshkumar
zope.interface provides extensive support for design by contract. http://pypi.python.org/pypi/zope.interface. This package can be used independently of zope in other projects. - Shailesh On Aug 12, 2:20 am, Ethan Furman wrote: > Charles Yeomans wrote: > > > On Aug 11, 2009, at 3:30 PM, Ethan Furm

Re: httplib incredibly slow :-(

2009-08-12 Thread shaileshkumar
We use PyCURL on Windows. http://pycurl.sourceforge.net/ provides pre- built versions for Windows and it works out of the box. - Shailesh On Aug 12, 7:14 pm, Max Erickson wrote: > Chris Withers wrote: > > > I'm still reeling from what seems to be such a huge problem with > > httplib that seem

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread shaileshkumar
Hello, EPYDOC is very good for automatic generation of documentation from source code. You may also consider Sphinx http://sphinx.pocoo.org/ which is used for many projects including the official Python documentation, documentation of Zope (http://docs.zope.org/). See the full list of projects us

Re: Need cleanup advice for multiline string

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 07:47:58 -0700, Robert Dailey wrote: > On Aug 12, 9:41 am, Robert Dailey wrote: ... > > I was actually joking about my remark, I was making fun of the fact > > that Bearophile took my figure of speech literally. Keep in mind that the Internet is a global forum, and not ever

Re: Need cleanup advice for multiline string

2009-08-12 Thread Simon Forman
On Aug 12, 10:41 am, Robert Dailey wrote: > On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: > > > > > On 01:27 pm, jeanmic...@sequans.com wrote: > > > >Simon Brunning wrote: > > >>2009/8/11 Robert Dailey : > > >>>On Aug 11, 3:40 pm, Bearophile wrote: > > There are gals too here. > > >>>I

Re: better way?

2009-08-12 Thread Pet
On Aug 12, 4:29 pm, Scott David Daniels wrote: > Pet wrote: > > On 11 Aug., 22:19, "Rami Chowdhury" wrote: > >> Ah, my apologies, I must have been getting it confused with ON UPDATE   > >> [things]. Thanks for correcting me. > > >> On Tue, 11 Aug 2009 13:10:03 -0700, Matthew Woodcraft   > > >> w

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 06:24:18 -0700, Paul Boddie wrote: > On 12 Aug, 14:08, Steven D'Aprano cybersource.com.au> wrote: >> >> With tens of millions of web users, it's no surprise that Wikipedia can >> attract thousands of editors. But this does not apply to Python, which >> starts from a comparativ

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Mark Lawrence
Esmail wrote: Hello, A project that I have been working on is getting larger and more complex, and I would like to unload some of the information from my memory/head to some other media (a set of web pages?). I am primarily interested in documenting the classes/methods. This documentation is pr

Re: Need cleanup advice for multiline string

2009-08-12 Thread Robert Dailey
On Aug 12, 9:41 am, Robert Dailey wrote: > On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: > > > > > > > On 01:27 pm, jeanmic...@sequans.com wrote: > > > >Simon Brunning wrote: > > >>2009/8/11 Robert Dailey : > > >>>On Aug 11, 3:40 pm, Bearophile wrote: > > There are gals too here. > > >

Re: Need cleanup advice for multiline string

2009-08-12 Thread Robert Dailey
On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote: > On 01:27 pm, jeanmic...@sequans.com wrote: > > > > > > >Simon Brunning wrote: > >>2009/8/11 Robert Dailey : > >>>On Aug 11, 3:40 pm, Bearophile wrote: > There are gals too here. > >>>It's a figure of speech. And besides, why would I want p

Re: better way?

2009-08-12 Thread Scott David Daniels
Pet wrote: On 11 Aug., 22:19, "Rami Chowdhury" wrote: Ah, my apologies, I must have been getting it confused with ON UPDATE [things]. Thanks for correcting me. On Tue, 11 Aug 2009 13:10:03 -0700, Matthew Woodcraft wrote: "Rami Chowdhury" writes: IIRC Postgres has had ON DUPLICATE KEY

Re: httplib incredibly slow :-(

2009-08-12 Thread Max Erickson
Chris Withers wrote: > > I'm still reeling from what seems to be such a huge problem with > httplib that seem to be largely ignored :-( > > Chris > There is an httplib2 (but I don't know anything further about it...): http://code.google.com/p/httplib2/ Calling wget or curl using a subprocess

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Mark Lawrence
Paul Boddie wrote: [snip] One can always spend one's time doing something which isn't 100% enjoyable or 100% rewarding if one feels that the time is still being spent on something worthwhile. I'm getting the feeling that lots of Python-related stuff doesn't quite satisfy such criteria any more.

Re: Need cleanup advice for multiline string

2009-08-12 Thread exarkun
On 01:27 pm, jeanmic...@sequans.com wrote: Simon Brunning wrote: 2009/8/11 Robert Dailey : On Aug 11, 3:40 pm, Bearophile wrote: There are gals too here. It's a figure of speech. And besides, why would I want programming advice from a woman? lol. Thanks for the help. Give the attitudes sti

best practice for documenting a project? pydoc?

2009-08-12 Thread Esmail
Hello, A project that I have been working on is getting larger and more complex, and I would like to unload some of the information from my memory/head to some other media (a set of web pages?). I am primarily interested in documenting the classes/methods. This documentation is primarily for my

Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 8:52 am, Dave Angel wrote: > Supply us with just enough source code to actually try it, give the full > error message including traceback, and tell us what you expected to > see.  Also tell us Python version   (sys.version) > > So far you've done none of these.  When I try the following

Re: Need cleanup advice for multiline string

2009-08-12 Thread Jean-Michel Pichavant
Simon Brunning wrote: 2009/8/11 Robert Dailey : On Aug 11, 3:40 pm, Bearophile wrote: There are gals too here. It's a figure of speech. And besides, why would I want programming advice from a woman? lol. Thanks for the help. Give the attitudes still prevalent in our indu

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Paul Boddie
On 12 Aug, 14:08, Steven D'Aprano wrote: > > With tens of millions of web users, it's no surprise that Wikipedia can > attract thousands of editors. But this does not apply to Python, which > starts from a comparatively tiny population, primarily those interested > in Python. Have a look at the Wi

  1   2   >