Re: create shell history with python

2009-08-12 Thread garabik-news-2005-05
Diez B. Roggisch wrote: > Joel Juvenal Rivera Rivera schrieb: >> I been thinking how to make a 'bash like history shell' in python, >> i don't know if with stdin and stdout i can accomplish this or do i >> need something like curses and stuff like that, anyway im start to >> figure this out. >> Do

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Steven D'Aprano
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 it, but it is certainly reasonable. > not as warni

Re: hashability

2009-08-12 Thread Asun Friere
On Aug 12, 4:52 pm, James Stroud wrote: > Sorry for being a twit. Don't be ridiculous. You haven't been a twit, I have! I've just had a complete "blonde" moment here (with apologies to any real blondes out there. My only excuse is that I've been up to 02:30 for the last three nights running (

Re: ElementTree - Howto access text within XML tag element...

2009-08-12 Thread Stefan Behnel
cmalmqui wrote: > tree = etree.parse('10_07_2009 16_48_00_history.tcx') > root = tree.getroot() > > elem = root[0][0] > > # iterate over all laps > for i in range(1, len(elem)-1): Note that you can iterate over elements as in for lap_element in elem: # ... Then use

Re: hashability

2009-08-12 Thread Asun Friere
On Aug 12, 5:14 pm, Dennis Lee Bieber wrote: > c1 = C() > c2 = C() > > {c1:4}[c2] > > to behave? That IS the equivalent of your statement -- two instances are > two distinctly different entities... > Thankyou, that is EXACTLY the mistake I made that sent me off into lunacy. At the risk of furth

Re: hashability

2009-08-12 Thread James Stroud
Dennis Lee Bieber wrote: On Tue, 11 Aug 2009 17:54:36 -0700, James Stroud declaimed the following in gmane.comp.python.general: ... py> {C():4}[C()] Traceback (most recent call last): File "", line 1, in : <__mai

Re: hashability

2009-08-12 Thread Steven D'Aprano
On Tue, 11 Aug 2009 17:54:36 -0700, James Stroud wrote: > Hello All, > > I wrote the function to test hashability of arbitrary objects. My reason > is that the built-in python (2.5) hashing is too permissive for some > uses. A symptom of this permissiveness comes from the ability to > successfull

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Steven D'Aprano
On Tue, 11 Aug 2009 13:20:52 -0700, Douglas Alan wrote: > On Aug 11, 2:00 pm, Steven D'Aprano cybersource.com.au> wrote: > >> > test.cpp:1:1: warning: unknown escape sequence '\y' >> >> Isn't that a warning, not a fatal error? So what does temp contain? > > My "Annotated C++ Reference Manual" i

Re: better way?

2009-08-12 Thread Pet
On 12 Aug., 09:14, Dennis Lee Bieber wrote: > On Tue, 11 Aug 2009 11:45:50 -0700 (PDT), Pet > declaimed the following in gmane.comp.python.general: > > > Oh, forgotten to mention. It's PostGres > >         Really? There are still installations of an RDBMS that predates the > commonalization of SQ

Re: httplib incredibly slow :-(

2009-08-12 Thread Chris Withers
Answering myself... Chris Withers wrote: In article , Chris Withers wrote: Does anyone know of an alternative library for creating http requests and getting their responses that's faster but hopefully has a similar interface? PyCurl This seems to be a wrapper around libcurl. Does it wor

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

2009-08-12 Thread Steven D'Aprano
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 organization of the docs >>> (for example, the mis-placem

Re: Need cleanup advice for multiline string

2009-08-12 Thread Simon Brunning
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 industry (cf

Invitation to connect on LinkedIn

2009-08-12 Thread Jey Simhan
LinkedIn I'd like to add you to my professional network on LinkedIn. - Jey Learn more: https://www.linkedin.com/e/isd/682391381/2q9uIjvU/ -- (c) 2009, LinkedIn Corporation -- http://mail.python.org/mailman/listinfo/python-list

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

2009-08-12 Thread Hendrik van Rooyen
On Tuesday 11 August 2009 19:53:16 Steven D'Aprano wrote: > You want community input into the docs, but you're not willing to give > that input except to bitch and moan and sook that the tracker is no good. wtf does the verb "sook" mean? I find: sook   /sʊk/ Show Spelled Pronunciation [so

Re: Scraping Wikipedia with Python

2009-08-12 Thread Thorsten Kampe
* Dotan Cohen (Tue, 11 Aug 2009 21:29:40 +0300) > >    Wikipedia has an API for computer access.  See > > > >        http://www.mediawiki.org/wiki/API > > > > Yes, I am aware of this as well. Does anyone know of a python class > for easily interacting with it, or do I need to roll my own. http://

Re: looping through values in a dictionary and appending to a list

2009-08-12 Thread Andre Engels
On Tue, Aug 11, 2009 at 8:17 PM, Krishna Pacifici wrote: > Nevermind, > got it. > > Sorry. > Krishna Pacifici 08/11/09 2:12 PM >>> > Hi, > I want to append the values of a dictionary to a list.  I have a dictionary > sec_dict_clean and I want to append the values to a list, but am having a > h

Re: Need cleanup advice for multiline string

2009-08-12 Thread Hendrik van Rooyen
On Tuesday 11 August 2009 22:52:34 Robert Dailey wrote: > On Aug 11, 3:40 pm, Bearophile wrote: > > Robert Dailey: > > > This breaks the flow of scope. Would you guys solve this > > > problem by moving failMsg into global scope? > > > Perhaps through some other type of syntax? > > > > There are ga

Re: Unrecognized escape sequences in string literals

2009-08-12 Thread Steven D'Aprano
On Tue, 11 Aug 2009 14:29:43 -0700, Douglas Alan wrote: > I need to preface this entire post with the fact that I've already used > ALL of the arguments that you've provided on my friend before I ever > even came here with the topic, and my own arguments on why Python can be > considered to be doi

Re: for key, value in dict.() - how to get? (which func)

2009-08-12 Thread Gary Duzan
In article , dmitrey wrote: >hi all, >which method should I use to get iterator over (key, value) pairs for >Python dict, Python v 2.6 and above? dict.iteritems() >>> import sys >>> for (key, value) in sys.modules.iteritems(): print key, value Gary Du

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

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 10:45:51 +0200, Hendrik van Rooyen wrote: > On Tuesday 11 August 2009 19:53:16 Steven D'Aprano wrote: > >> You want community input into the docs, but you're not willing to give >> that input except to bitch and moan and sook that the tracker is no >> good. > > wtf does the v

Re: Need cleanup advice for multiline string

2009-08-12 Thread MRAB
Hendrik van Rooyen wrote: On Tuesday 11 August 2009 22:52:34 Robert Dailey wrote: On Aug 11, 3:40 pm, Bearophile wrote: Robert Dailey: This breaks the flow of scope. Would you guys solve this problem by moving failMsg into global scope? Perhaps through some other type of syntax? There are ga

matching patterns after regex?

2009-08-12 Thread Martin
Hi, I have a string (see below) and ideally I would like to pull out the decimal number which follows the bounding coordinate information. For example ideal from this string I would return... s = '\nGROUP = ARCHIVEDMETADATA\n GROUPTYPE= MASTERGROUP\n\n GROUP

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

2009-08-12 Thread Paul Boddie
On 12 Aug, 09:58, Steven D'Aprano wrote: > > We know that there are problems. We've said repeatedly that corrections > and patches are welcome. We've repeatedly told you how to communicate > your answer to the question of what should be done. None of this is good > enough for you. I don't know wha

SQLObject 0.11.0

2009-08-12 Thread Oleg Broytmann
Hello! I'm pleased to announce version 0.11.0, the first stable release of 0.11 branch of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be e

Re: adding multiple new values to the same key in a dictionary

2009-08-12 Thread Dave Angel
Dave Angel wrote: Krishna Pacifici wrote: Hi, I want to be able to add multiple new values to a key in a dictionary. I have tried the following: sec_dict_clean= {88: [87, 89, 78, 98], 58: [57, 59, 48, 68], 69: [79], 95: [94, 96, 85]} for i in range(len(sec_dict_clean.values())): for j in

Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 1:51 am, James Stroud wrote: > andrew cooke wrote: > > Is there a way to make this work (currently scope and join are > > undefined at runtime when the inner class attributes are defined): > > > class _StreamFactory(object): > > >     @staticmethod > >     def __call__(lines, source, jo

Re: Frustrated with scopes

2009-08-12 Thread andrew cooke
On Aug 12, 7:49 am, andrew cooke wrote: > On Aug 12, 1:51 am, James Stroud > wrote: > > > > > andrew cooke wrote: > > > Is there a way to make this work (currently scope and join are > > > undefined at runtime when the inner class attributes are defined): > > > > class _StreamFactory(object): > >

Re: matching patterns after regex?

2009-08-12 Thread Bernard
On 12 août, 06:15, Martin wrote: > Hi, > > I have a string (see below) and ideally I would like to pull out the > decimal number which follows the bounding coordinate information. For > example ideal from this string I would return... > > s = '\nGROUP                  = ARCHIVEDMETADATA\n > GROUPT

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

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 03:32:08 -0700, Paul Boddie wrote: > On 12 Aug, 09:58, Steven D'Aprano > wrote: >> >> We know that there are problems. We've said repeatedly that corrections >> and patches are welcome. We've repeatedly told you how to communicate >> your answer to the question of what should

Re: Frustrated with scopes

2009-08-12 Thread Diez B. Roggisch
andrew cooke wrote: > On Aug 12, 7:49 am, andrew cooke wrote: >> On Aug 12, 1:51 am, James Stroud >> wrote: >> >> >> >> > andrew cooke wrote: >> > > Is there a way to make this work (currently scope and join are >> > > undefined at runtime when the inner class attributes are defined): >> >> > >

Re: matching patterns after regex?

2009-08-12 Thread Martin
On Aug 12, 12:53 pm, Bernard wrote: > On 12 août, 06:15, Martin wrote: > > > > > Hi, > > > I have a string (see below) and ideally I would like to pull out the > > decimal number which follows the bounding coordinate information. For > > example ideal from this string I would return... > > > s =

Re: Frustrated with scopes

2009-08-12 Thread Steven D'Aprano
On Wed, 12 Aug 2009 04:49:06 -0700, andrew cooke wrote: >> It would be helpful if you were to describe the type of behavior you >> expect. > > Sorry, I didn't make myself clear. When run the code gives > NameError: name 'source' is not defined > because the class namespace blocks the function n

Re: matching patterns after regex?

2009-08-12 Thread Steven D'Aprano
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 case, because you're using regular expressions, you should use a raw string: re.findall(r"(\w+COORDINATE).*\s+VALUE\s+=\s([\

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

2009-08-12 Thread Antoine Pitrou
Paul Boddie boddie.org.uk> writes: > > A free-for-all isn't likely to be the best solution for more actively > edited Python documentation, but Wiki solutions undeniably provide a > superior "fast path" for edits by trusted users to be incorporated and > published in accessible end-user documenta

Re: matching patterns after regex?

2009-08-12 Thread Martin
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 this case, because you're using regular expressions, you should use a > raw s

Re: Frustrated with scopes

2009-08-12 Thread Dave Angel
andrew cooke wrote: Is there a way to make this work (currently scope and join are undefined at runtime when the inner class attributes are defined): class _StreamFactory(object): @staticmethod def __call__(lines, source, join=''.join): class Line(object): __source

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

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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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

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 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

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 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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

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: 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

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: 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: 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

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 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

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

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

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) > > >

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

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: 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

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: 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

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

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

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

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.

  1   2   >