TriZPUG August 2009 Meeting

2009-08-11 Thread Chris Calloway
Thursday, August 27, 7pm in Room 2015, Engineering Buildging I, NCSU Centennial Campus, Raleigh. http://trizpug.org/Members/cbc/aug-09-mtg/ Canonical developer Gary Poster will give his OSCON presentation Launchpad Foundations: If the Abstractions Don't Kill Us... The talk is about how

ANN Join ChiPy on Thursday August 13, 2009 Matplotlib, best meeting ever.

2009-08-11 Thread Brian Ray
Chicago Python User Group = We welcome back Dr John Hunter. Matplotlib is probably the most popular open source 2D plotting library ever. It has multiple rendering engines, supports tons of plot formats, and even typesets complicated equations properly. Matplotlib,

ANN: M2Crypto 0.20

2009-08-11 Thread Heikki Toivonen
I am please to announce the M2Crypto 0.20 release, which was in development for over nine months. Over 30 bugs fixed by more than ten people. Download links and bug filing instructions on the homepage at http://chandlerproject.org/Projects/MeTooCrypto. M2Crypto is the most complete Python wrapper

DjangoCon Schedule

2009-08-11 Thread Robert Lofthouse
Hi All, We have released the DjangoCon Schedule at: http://www.djangocon.org/2009/conference/schedule/ and will be releasing more information over the next day or two. DjangoCon is on 8th - 12th September in Portland, Oregon at the DoubleTree Green Hotel. We had a great time last year at Google

GOZERBOT 0.9.1 released

2009-08-11 Thread Bart Thate
here it is .. GOZERBOT 0.9.1 !! Main change this time is the distribution method, we now provide a tar.gz with all the dependencies included. This means that you can run the bot locally without any root required. Python 2.5 or higher needed, see http://gozerbot.org Enjoy ! about GOZERBOT:

[ANNOUNCE] PyGobject 2.19.0 - unstable

2009-08-11 Thread Gian Mario Tagliaretti
I am pleased to announce version 2.19.0 of the Python bindings for GObject. The new release is available from ftp.gnome.org as and its mirrors as soon as its synced correctly: http://download.gnome.org/sources/pygobject/2.19/ What's new since PyGObject 2.18.0? - Add macros to help

Exceptional Conditions: Regular Toronto Python User's group on Tuesday

2009-08-11 Thread Mike C. Fletcher
We'll have our regular Toronto Python User's Group (PyGTA) meeting on Tuesday the 18th of August. This month's topic: Exceptional Conditions: when to ignore, assert, raise, log, except, or email? When programming in Python, we often run into situations which are not normal or

How to pickle a lambda function?

2009-08-11 Thread Terry
Hi, I'm trying to implement something like: remote_map(fun, list) to execute the function on a remove machine. But the problem is I cannot pickle a lambda function and send it to the remote machine. Is there any possible way to pickle (or other method) any functions including lambda? br,

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Steven D'Aprano
On Mon, 10 Aug 2009 20:05:00 -0400, David Lyon wrote: So, what you're advocating is let things stay how they are... If it's not broken, don't fix it. Ignore feedback... tell people to freak off... Only useless feedback. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: variable scoping question.

2009-08-11 Thread Steven D'Aprano
On Mon, 10 Aug 2009 08:46:17 -0700, Cornelius Keller wrote: On 10 Aug., 17:12, Diez B. Roggisch de...@nospam.web.de wrote: Cornelius Keller wrote: [snip] http://effbot.org/zone/default-values.htm Diez Ok thank you. I' understand now why. I still think this is very confusing, because

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Steven D'Aprano
On Mon, 10 Aug 2009 15:17:24 -0700, Douglas Alan wrote: From: Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 10 Aug 2009 00:32:30 -0700, Douglas Alan wrote: In C++, if I know that the code I'm looking at compiles, then I never need worry that I've misinterpreted

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

2009-08-11 Thread Ned Deily
In article 1ad8dac1-8fff-493a-a197-d847e7b6a...@c2g2000yqi.googlegroups.com, cmalmqui cmalm...@gmail.com wrote: I am writing on a small XML parser and are currently stuck as I am not able to get the whole element name in ElementTree. Please see the below example where print root[0][0]

Re: How to pickle a lambda function?

2009-08-11 Thread Duncan Booth
Terry terry.yin...@gmail.com wrote: I'm trying to implement something like: remote_map(fun, list) to execute the function on a remove machine. But the problem is I cannot pickle a lambda function and send it to the remote machine. Is there any possible way to pickle (or other method)

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

2009-08-11 Thread Antoine Pitrou
r rt8396 at gmail.com writes: On Aug 9, 11:02 pm, David Lyon david.l...@preisshare.net wrote: Since you're talking about documentation, which is a part of python, don't you think you should be discussing it on python-dev ? Yea, them's be a friendly bunch to noob ideas ;). Hey i got a

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

2009-08-11 Thread Diez B. Roggisch
cmalmqui schrieb: Hi, I am writing on a small XML parser and are currently stuck as I am not able to get the whole element name in ElementTree. Please see the below example where print root[0][0] returns Element 'Activity' at 018A3938 Is there a way to get hold of the Running string in the

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

2009-08-11 Thread Mark Lawrence
Antoine Pitrou wrote: r rt8396 at gmail.com writes: On Aug 9, 11:02 pm, David Lyon david.l...@preisshare.net wrote: Since you're talking about documentation, which is a part of python, don't you think you should be discussing it on python-dev ? Yea, them's be a friendly bunch to noob ideas

Re: How to pickle a lambda function?

2009-08-11 Thread Terry
On Aug 11, 3:42 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Terry terry.yin...@gmail.com wrote: I'm trying to implement something like: remote_map(fun, list) to execute the function on a remove machine. But the problem is I cannot pickle a lambda function and send it to the

Re: Problem Regarding Handling of Unicode string

2009-08-11 Thread John Machin
On Aug 10, 9:26 pm, joy99 subhakolkata1...@gmail.com wrote: Dear Group, I am using Python26 on WindowsXP with service pack2. My GUI is IDLE. I am using Hindi resources and get nice output like: एक where I can use all the re functions and other functions without doing any

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Bruno Desthuilliers
r a écrit : (snip) A little note for tutorial writers: == Dear Expert, Whilst writing any tutorial on any subject matter please remember, you may be an expert, but mostly *non-experts* will be reading your material... I can only second Paul on this : just

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Brian
On Fri, Jul 31, 2009 at 6:12 PM, Kee Nethery k...@kagi.com wrote: I too find the Python docs not very useful and it really slows down my learning curve. I wonder if it would make sense to find good tech writers, get a quotes, and get some professionally written documentation WITH LOTS OF

Re: With or without leading underscore...

2009-08-11 Thread Bruno Desthuilliers
Carl Banks a écrit : (snip) class A(object): def __init__(self,*args,**kwargs): raise TypeError('Type not callable; use factory function instead') @classmethod def _create_object(cls,initial_value): self = object.__new__(cls) # avoid __init__ self.value =

Is there any package implanation the following arithmetics?

2009-08-11 Thread zhongshq
Hi, I wonder if there has any package can check whether two rectangles are overlap, is a dot inside or outside a polygon, etc. Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help in configuration for TimedRotatingFileHandler

2009-08-11 Thread Vinay Sajip
On Aug 10, 3:52 pm, Dave Angel da...@ieee.org wrote: Lokesh Maremalla wrote: Traceback (most recent call last):   File c:\Python25\lib\logging\handlers.py, line 74, in emit     self.doRollover()   File c:\Python25\lib\logging\handlers.py, line 274, in doRollover    

UML for Python or some other Graphical Notation Language

2009-08-11 Thread llothar
This is more an academic question right now but was there ever some work in progress how UML could be made better for Python or script languages in general. It is so extremely deep interwoven with Java/C++ language implementations that there are a lot of modified notiations necessary. Or is

Search and write to .txt file

2009-08-11 Thread Helvin
Hi everyone, I am writing some python script that should find a line which contains '1' in the data.txt file, then be able to move a certain number of lines down, before replacing a line. At the moment, I am able to find the line '1', but when I use f.seek to move, and then rewrite, what I write

Re: Search and write to .txt file

2009-08-11 Thread Kushal Kumaran
On Tue, Aug 11, 2009 at 4:52 PM, Helvinhelvin...@gmail.com wrote: Hi everyone, I am writing some python script that should find a line which contains '1' in the data.txt file, then be able to move a certain number of lines down, before replacing a line. At the moment, I am able to find the

Re: dictionary help

2009-08-11 Thread Dave Angel
Krishna Pacifici wrote: Hi, kind of a newbie here, but I have two questions that are probably pretty simple. 1. I need to get rid of duplicate values that are associated with different keys in a dictionary. For example I have the following code. s={} s[0]=[10,2,3] s[10]=[22,23,24]

add fields in a existing dbf

2009-08-11 Thread Alonso Luján Torres Taño
Hi! I'm trying to modify a dbf adding a new field in a python script, but I can't. Just I can add a field in new dbf created in the same script. I tryed with: db = dbf.Dbf(../filesource.dbf,new =False, readOnly=False) ... db.addField((PESO,N,32,8)) and return error: Traceback

Re: UML for Python or some other Graphical Notation Language

2009-08-11 Thread Diez B. Roggisch
llothar wrote: This is more an academic question right now but was there ever some work in progress how UML could be made better for Python or script languages in general. It is so extremely deep interwoven with Java/C++ language implementations that there are a lot of modified notiations

test message

2009-08-11 Thread skip
Sorry for the low content email. Testing the mail-to-news gateway on mail.python.org. Don't flame me for not using a test newsgroup. ;-) -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ Getting old sucks, but it beats dying young --

Re: test message

2009-08-11 Thread Skip Montanaro
On Aug 11, 7:40 am, s...@pobox.com wrote: Sorry for the low content email.  Testing the mail-to-news gateway on mail.python.org.  Don't flame me for not using a test newsgroup. ;-) Posting a followup to test the return path (news-to-mail). S --

Re: Search and write to .txt file

2009-08-11 Thread Piet van Oostrum
Helvin helvin...@gmail.com (H) wrote: H Hi everyone, H I am writing some python script that should find a line which contains H '1' in the data.txt file, then be able to move a certain number of H lines down, before replacing a line. At the moment, I am able to find H the line '1', but when I

Extracting matrix from a text file

2009-08-11 Thread telek...@hotmail.com
Hello to all!! I am new in python, and I am running it on Mac with Smultron editor. I need to read a textfile that includes numbers (in a matrix form), indexes, and strings, like this: Marsyas-kea distance matrix for MIREX 2007 Audio Similarity Exchange Q/R1 2

Re: Search and write to .txt file

2009-08-11 Thread Mark Lawrence
Helvin wrote: Hi everyone, I am writing some python script that should find a line which contains '1' in the data.txt file, then be able to move a certain number of lines down, before replacing a line. At the moment, I am able to find the line '1', but when I use f.seek to move, and then

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Piet van Oostrum
Steven D'Aprano ste...@remove.this.cybersource.com.au (SD) wrote: SD If I'm reading this page correctly, Python does behave as C++ does. Or at SD least as Larch/C++ does: SD http://www.cs.ucf.edu/~leavens/larchc++manual/lcpp_47.html They call them `non-standard escape sequences' for a reason:

Re: Extracting matrix from a text file

2009-08-11 Thread Mark Lawrence
telek...@hotmail.com wrote: Hello to all!! I am new in python, and I am running it on Mac with Smultron editor. I need to read a textfile that includes numbers (in a matrix form), indexes, and strings, like this: Marsyas-kea distance matrix for MIREX 2007 Audio Similarity Exchange Q/R1

Re: Search and write to .txt file

2009-08-11 Thread Dave Angel
Piet van Oostrum wrote: Helvin helvin...@gmail.com (H) wrote: H Hi everyone, H I am writing some python script that should find a line which contains H '1' in the data.txt file, then be able to move a certain number of H lines down, before replacing a line. At the moment, I am

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Ethan Furman
David Lyon wrote: On Mon, 10 Aug 2009 09:13:34 -0700, Ethan Furman et...@stoneleaf.us wrote: As someone who relies heavily on the docs I will also say that the idea of giving the ability to modify the official documentation to somebody who is /learning/ the language is, quite frankly,

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

2009-08-11 Thread rurpy
On 08/11/2009 01:47 AM, Antoine Pitrou wrote: rrt8396at gmail.com writes: On Aug 9, 11:02 pm, David Lyondavid.l...@preisshare.net wrote: Since you're talking about documentation, which is a part of python, don't you think you should be discussing it on python-dev ? Yea, them's be a

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Ethan Furman
Steven D'Aprano wrote: On Mon, 10 Aug 2009 08:21:03 -0700, Douglas Alan wrote: But you're right, it's too late to change this now. Not really. There is a procedure for making non-backwards compatible changes. If you care deeply enough about this, you could agitate for Python 3.2 to raise

Re: Extracting matrix from a text file

2009-08-11 Thread Colin J. Williams
telek...@hotmail.com wrote: Hello to all!! I am new in python, and I am running it on Mac with Smultron editor. I need to read a textfile that includes numbers (in a matrix form), indexes, and strings, like this: Marsyas-kea distance matrix for MIREX 2007 Audio Similarity Exchange Q/R1

Profiling a Callback Function

2009-08-11 Thread Nikolaus Rath
Hello, I am trying to profile a Python program that primarily calls a C extension. From within the C extension, a callback Python function is then called concurrently in several threads. When I tried to profile this application with import c_extension def callback_fn(args): # Do all

Re: dictionary help

2009-08-11 Thread Krishna Pacifici
Thanks for the help. Actually this is part of a much larger project, but I have unfortunately pigeon-holed myself into needing to do these things without a whole lot of flexibility. To give a specific example I have the following dictionary where I need to remove values that are duplicated

Re: Search and write to .txt file

2009-08-11 Thread Simon Forman
On Aug 11, 7:22 am, Helvin helvin...@gmail.com wrote: Hi everyone, I am writing some python script that should find a line which contains '1' in the data.txt file, then be able to move a certain number of lines down, before replacing a line. At the moment, I am able to find the line '1', but

Re: dictionary help

2009-08-11 Thread MRAB
Krishna Pacifici wrote: Thanks for the help. Actually this is part of a much larger project, but I have unfortunately pigeon-holed myself into needing to do these things without a whole lot of flexibility. To give a specific example I have the following dictionary where I need to remove

Re: add fields in a existing dbf

2009-08-11 Thread Ethan Furman
Alonso Luján Torres Taño wrote: Hi! I'm trying to modify a dbf adding a new field in a python script, but I can't. Just I can add a field in new dbf created in the same script. I tryed with: db = dbf.Dbf(../filesource.dbf,new =False, readOnly=False) ...

Re: dictionary help

2009-08-11 Thread Simon Forman
On Aug 11, 11:51 am, MRAB pyt...@mrabarnett.plus.com wrote: Krishna Pacifici wrote: Thanks for the help. Actually this is part of a much larger project, but I have unfortunately pigeon-holed myself into needing to do these things without a whole lot of flexibility. To give a specific

better way?

2009-08-11 Thread someone
Hello, I'd like to make insert into db if record not exist otherwise update. to save typing list of columns in both statements I do following query = SELECT location FROM table WHERE location = %s AND id = %s; result = self._getResult(db, query, [location,id]) fields = ['id', 'location', 'wl',

GOZERBOT 0.9.1 released

2009-08-11 Thread Bart Thate
here it is .. GOZERBOT 0.9.1 !! Main change this time is the distribution method, we now provide a tar.gz with all the dependencies included. This means that you can run the bot locally without any root required. Python 2.5 or higher needed, see http://gozerbot.org Enjoy ! about GOZERBOT:

Re: Is there any package implanation the following arithmetics?

2009-08-11 Thread Emile van Sebille
On 8/11/2009 1:49 AM zhongshq said... Hi, I wonder if there has any package can check whether two rectangles are overlap, is a dot inside or outside a polygon, etc. PythonCad at http://sourceforge.net/projects/pythoncad/ has intersections built in. Emile --

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread r
On Aug 11, 1:47 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 10 Aug 2009 20:05:00 -0400, David Lyon wrote: Ignore feedback... tell people to freak off... Only useless feedback. And who decides what is useless and what isn't Steven?. You?, alex23?, Bruno?, Paul?

Re: dictionary help

2009-08-11 Thread Krishna Pacifici
Wow, thanks MRAB and Simon, you guys are good. I guess I will go ahead and ask the next question that has also stumped me for awhile now. So basically I need to loop through the values in the new dictionary and append attributes of a class object. Each of the values (and keys) represent a

Any built-in function for smallest positive floating point number?

2009-08-11 Thread Maria Liukis
Hello everybody, Is somebody aware of built-in Python's function that would return a value for smallest positive double precision floating point number (analogous to 'realmin' in Matlab). Python has built-in sys.maxint but I could not find anything for float. Any help would be greatly

Scraping Wikipedia with Python

2009-08-11 Thread Dotan Cohen
I plan on making a geography-learning Anki [1] deck, and Wikipedia has the information that I need in nicely formatted tables on the side of each country's page. Has someone already invented a wheel to parse and store that data (scrape)? It is probably not difficult to code, and within the

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
r wrote: On Aug 11, 1:47 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 10 Aug 2009 20:05:00 -0400, David Lyon wrote: Ignore feedback... tell people to freak off... Only useless feedback. [snip] I am sorry but i feel many here would not judge fairly based on the

Re: Is feedparser deprecated?

2009-08-11 Thread John Nagle
Gabriel Genellina wrote: En Fri, 07 Aug 2009 16:07:48 -0300, John Nagle na...@animats.com escribió: Feedparser requires SGMLlib, which has been removed from Python 3.0. Feedparser hasn't been updated since 2007. Does this mean Feedparser is dead? Since we have generic and easy of use XML

Re: Any built-in function for smallest positive floating point number?

2009-08-11 Thread Maria Liukis
A bit more of googling gave me an answer: import numpy as np np.finfo(np.double).tiny array(2.2250738585072014e-308) Thanks, Masha liu...@usc.edu On Aug 11, 2009, at 10:29 AM, Maria Liukis wrote: Hello everybody, Is somebody aware of built-in Python's function that

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

2009-08-11 Thread Steven D'Aprano
On Tue, 11 Aug 2009 07:57:28 -0700, rurpy wrote: On 08/11/2009 01:47 AM, Antoine Pitrou wrote: rrt8396at gmail.com writes: On Aug 9, 11:02 pm, David Lyondavid.l...@preisshare.net wrote: Since you're talking about documentation, which is a part of python, don't you think you should be

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Steven D'Aprano
On Tue, 11 Aug 2009 15:50:01 +0200, Piet van Oostrum wrote: Steven D'Aprano ste...@remove.this.cybersource.com.au (SD) wrote: SD If I'm reading this page correctly, Python does behave as C++ does. Or at SD least as Larch/C++ does: SD http://www.cs.ucf.edu/~leavens/larchc++manual/lcpp_47.html

Networked Broadcast Messaging

2009-08-11 Thread squishywaf...@gmail.com
I'm not exactly sure what the term for this would be, but I was wondering if there were any Python packages that supported some kind of ad-hoc message broadcasting. What I'd like to do is something like this: * On a number of workhorse machines, a process listens for network messages from our

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

2009-08-11 Thread Krishna Pacifici
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 hard time looping through the values in the dictionary. I have tried

Re: Scraping Wikipedia with Python

2009-08-11 Thread John Nagle
Dotan Cohen wrote: I plan on making a geography-learning Anki [1] deck, and Wikipedia has the information that I need in nicely formatted tables on the side of each country's page. Has someone already invented a wheel to parse and store that data (scrape)? Wikipedia has an API for

Re: Scraping Wikipedia with Python

2009-08-11 Thread Dotan Cohen
   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. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il --

Re: Networked Broadcast Messaging

2009-08-11 Thread gregarican
On Aug 11, 2:14 pm, squishywaf...@gmail.com squishywaf...@gmail.com wrote: I'm not exactly sure what the term for this would be, but I was wondering if there were any Python packages that supported some kind of ad-hoc message broadcasting. What I'd like to do is something like this: * On a

Re: better way?

2009-08-11 Thread Kushal Kumaran
On Tue, Aug 11, 2009 at 10:03 PM, someonepetshm...@googlemail.com wrote: Hello, I'd like to make insert into db if record not exist otherwise update. to save typing list of columns in both statements I do following snip is there better or more readable way to do it? Well, mysql, in

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

2009-08-11 Thread Paul Rubin
Steven D'Aprano st...@remove-this-cybersource.com.au writes: - if people are keen on a Python wiki, then by all means publish one, just don't expect the Python dev team to build and manage it for you; There are already some nice ones at: http://en.wikibooks.org/wiki/Python --

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Raymond Hettinger
[Paul Rubin] I think the Python tutorial is aimed at users who are newbies to Python but not newbies to programming.  Writing a tutorial for total newbies is a completely different problem, that would result in a much different document that's less useful to the existing tutorial's intended

Re: better way?

2009-08-11 Thread Pet
On 11 Aug., 20:39, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Tue, Aug 11, 2009 at 10:03 PM, someonepetshm...@googlemail.com wrote: Hello, I'd like to make insert into db if record not exist otherwise update. to save typing list of columns in both statements I do following

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Paul Rubin
r rt8...@gmail.com writes: Some say the tutorial is not meant for non-programmers, but for programmers with no Python experience. So! How does that justify obstruction of the tut? Why not present the same information in a way both can easily understand? I agree that a tutorial for

Re: Scraping Wikipedia with Python

2009-08-11 Thread David C Ullrich
On Tue, 11 Aug 2009 21:29:40 +0300, Dotan Cohen wrote:    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. Try reading a

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Paul Rubin
Raymond Hettinger pyt...@rcn.com writes: Here is the page specifically marked for those who are new to programming: http://wiki.python.org/moin/BeginnersGuide Oh cool, I didn't know about that one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread max bianco
On Thu, Aug 6, 2009 at 2:36 PM, Kee Netheryk...@kagi.com wrote: As someone trying to learn the language I want to say that the tone on this list towards people who are trying to learn Python  feels like it has become anti-newbies. Learning a new language is difficult enough without seeing

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

2009-08-11 Thread Rami Chowdhury
Hi Dmitrey, I think what you're looking for is myDict.items(), or myDict.iteritems(). Cheers, Rami On Tue, 11 Aug 2009 12:15:13 -0700, dmitrey dmitrey.kros...@scipy.org wrote: hi all, which method should I use to get iterator over (key, value) pairs for Python dict, Python v 2.6 and

Re: Programming by Contract

2009-08-11 Thread Ethan Furman
Ethan Furman wrote: Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very brief look at pycontract (http://www.wayforward.net/pycontract/) and now I have at least one question: Is this basically another way of thinking about unit

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

2009-08-11 Thread dmitrey
Yes, thank you, items() is the correct approach, on the other hand I have already get rid of the cycle. Regards, D. On Aug 11, 10:26 pm, Rami Chowdhury rami.chowdh...@gmail.com wrote: Hi Dmitrey, I think what you're looking for is myDict.items(), or myDict.iteritems(). Cheers, Rami On

Re: better way?

2009-08-11 Thread Pet
On 11 Aug., 21:23, Rami Chowdhury rami.chowdh...@gmail.com wrote: IIRC Postgres has had ON DUPLICATE KEY UPDATE functionality longer than   MySQL... Ok, I've completely failed here :) Thanks, man On Tue, 11 Aug 2009 11:45:50 -0700, Pet petshm...@googlemail.com wrote: On 11 Aug.,

Re: Scraping Wikipedia with Python

2009-08-11 Thread Brian
On Tue, Aug 11, 2009 at 12:29 PM, Dotan Cohen dotanco...@gmail.com wrote: 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

adding multiple new values to the same key in a dictionary

2009-08-11 Thread Krishna Pacifici
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 range(len(sec_dict_clean.values()[i])):

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread r
Ok people follow me here. Open your winders help file and click the Tutorial link. What is this FLUFF doing here!?!?! Where is the damn index? Where is the damn tutorial? I want to learn Python not read the HISTORY OF THE WORLD. Upon clicking the Tutorial link pre 2.6, a nice menu was placed

Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
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 the indents. In this case

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
r wrote: Ok people follow me here. Open your winders help file and click the Tutorial link. What is this FLUFF doing here!?!?! Where is the damn index? Where is the damn tutorial? I want to learn Python not read the HISTORY OF THE WORLD. Upon clicking the Tutorial link pre 2.6, a nice menu was

Re: better way?

2009-08-11 Thread Matthew Woodcraft
Rami Chowdhury rami.chowdh...@gmail.com writes: IIRC Postgres has had ON DUPLICATE KEY UPDATE functionality longer than MySQL... PostgreSQL does not have ON DUPLICATE KEY UPDATE. The SQL standard way to do what the OP wants is MERGE. PostgreSQL doesn't have that either. -M- --

Re: better way?

2009-08-11 Thread Rami Chowdhury
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 matt...@woodcraft.me.uk wrote: Rami Chowdhury rami.chowdh...@gmail.com writes: IIRC Postgres has had ON DUPLICATE KEY UPDATE

Re: Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
On Aug 11, 3:08 pm, Robert Dailey rcdai...@gmail.com wrote: 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

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

2009-08-11 Thread cmalmqui
On Aug 11, 9:51 am, Diez B. Roggisch de...@nospam.web.de wrote: cmalmqui schrieb: Hi, I am writing on a small XML parser and are currently stuck as I am not able to get the whole element name in ElementTree. Please see the below example where print root[0][0] returns Element

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Douglas Alan
On Aug 11, 2:00 pm, Steven D'Aprano st...@remove-this- 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 is packed, and surprisingly in Stroustrup's Third

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

2009-08-11 Thread cmalmqui
On Aug 11, 9:13 am, Ned Deily n...@acm.org wrote: In article 1ad8dac1-8fff-493a-a197-d847e7b6a...@c2g2000yqi.googlegroups.com,  cmalmqui cmalm...@gmail.com wrote: I am writing on a small XML parser and are currently stuck as I am not able to get the whole element name in ElementTree.

httplib incredibly slow :-(

2009-08-11 Thread Chris Withers
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 = 'Basic '+encodestring('username:password').strip()

Bug in format specification in Python 3?

2009-08-11 Thread Robert Dailey
Hello, According to the Python 3.1 documentation, I can have a format specification like so: print( 'This is a hex number: {:#08x}'.format( 4 ) ) This will print: This is a hex number: 0x04 I notice that the '0x' portion is counted in the width, which was specified as 8. This seems wrong

Re: Need cleanup advice for multiline string

2009-08-11 Thread Mark Lawrence
Robert Dailey wrote: On Aug 11, 3:08 pm, Robert Dailey rcdai...@gmail.com wrote: 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

Re: Scraping Wikipedia with Python

2009-08-11 Thread Paul Rubin
Dotan Cohen dotanco...@gmail.com writes: Thanks. I read the first bit of that page, but did not finish it. Grepping it for Python led to to what I need. maybe you want dbpedia. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized escape sequences in string literals

2009-08-11 Thread Ethan Furman
Douglas Alan wrote: On Aug 11, 2:00 pm, Steven D'Aprano st...@remove-this- 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 is packed, and surprisingly in

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread r
Ah Ha! the docs are broken and i was right all along! Are the good folks at Python dev rolling a new installer as we speak, or we must wait for new version? -- http://mail.python.org/mailman/listinfo/python-list

Re: Need cleanup advice for multiline string

2009-08-11 Thread Bearophile
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 gals too here. This may help: http://docs.python.org/library/textwrap.html#textwrap.dedent Bye, bearophile --

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
r wrote: Ah Ha! the docs are broken and i was right all along! Are the good folks at Python dev rolling a new installer as we speak, or we must wait for new version? As I pointed out a few minutes ago thicko, the new version has been available for months. -- Kindest regards. Mark Lawrence.

New 2.6 and wx install = DLL load failed: The specified procedure could not be found

2009-08-11 Thread RJ
I just installed python-2.6.2.msi from Python.org and wxPython2.8-win32-ansi-2.8.10.1-py26.exe and now can't import this wx. (I had 2.4, but uninstalled) This reminds me of a basic question I had before: what are the compilers used for the Win32 binaries? Is this a compiler compatibility

Re: Programming by Contract

2009-08-11 Thread Charles Yeomans
On Aug 11, 2009, at 3:30 PM, Ethan Furman wrote: Ethan Furman wrote: Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very brief look at pycontract (http://www.wayforward.net/pycontract/ ) and now I have at least one question: Is

Re: Need cleanup advice for multiline string

2009-08-11 Thread Robert Dailey
On Aug 11, 3:40 pm, Bearophile bearophileh...@lycos.com 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 gals too here. This may

Re: Bug in format specification in Python 3?

2009-08-11 Thread MRAB
Robert Dailey wrote: Hello, According to the Python 3.1 documentation, I can have a format specification like so: print( 'This is a hex number: {:#08x}'.format( 4 ) ) This will print: This is a hex number: 0x04 I notice that the '0x' portion is counted in the width, which was specified

Re: dictionary help

2009-08-11 Thread MRAB
Krishna Pacifici wrote: Wow, thanks MRAB and Simon, you guys are good. I guess I will go ahead and ask the next question that has also stumped me for awhile now. So basically I need to loop through the values in the new dictionary and append attributes of a class object. Each of the values

  1   2   >