Re: exec statement with/without prior compile...

2009-05-26 Thread Gabriel Genellina
En Mon, 25 May 2009 11:07:13 -0300, Jaime Fernandez del Rio escribió: These weekend I've been tearing down to pieces Michele Simionato's decorator module, that builds signature preserving decorators. At the heart of it all there is a dynamically generated function, which works something similar

Re: What text editor is everyone using for Python

2009-05-26 Thread Lawrence D'Oliveiro
In message , Steven D'Aprano wrote: > On Tue, 26 May 2009 18:31:56 +1200, Lawrence D'Oliveiro wrote: > >> In message > b201-4b2445732...@v35g2000pro.googlegroups.com>, LittleGrasshopper >> wrote: >> >>> ... I am looking for suitable syntax files for [editor of choice] ... >> >> I don't underst

Re: how to get rid of pyc files ?

2009-05-26 Thread Gabriel Genellina
En Mon, 25 May 2009 17:00:00 -0300, escribió: On May 25, 12:08 am, Dave Angel wrote: Somebody else has already pointed out that you can tell Python not to create thosefiles(during your development stages). Yes, that's probably the best way to sort out the problems. It would of course be nic

Re: unicode confusing

2009-05-26 Thread Pet
On May 25, 6:07 pm, Paul Boddie wrote: > On 25 Mai, 17:39, someone wrote: > > > Hi, > > > reading content of webpage (encoded in utf-8) with urllib2, I can't > > get parsed data into DB > > > Exception: > > >   File "/usr/lib/python2.5/site-packages/pyPgSQL/PgSQL.py", line 3111, > > in execute >

Re: What text editor is everyone using for Python

2009-05-26 Thread CTO
On May 26, 3:23 am, Lawrence D'Oliveiro wrote: > In message , Steven > > D'Aprano wrote: > > On Tue, 26 May 2009 18:31:56 +1200, Lawrence D'Oliveiro wrote: > > >> In message >> b201-4b2445732...@v35g2000pro.googlegroups.com>, LittleGrasshopper > >> wrote: > > >>> ... I am looking for suitable syn

Re: What text editor is everyone using for Python

2009-05-26 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >I use kwrite when on a GUI. When I can't avoid editing files remotely >over ssh, I use nano. > >Why? I dislike Gnome's user-interface, and I find gedit slightly too >underpowered and dumbed down for my taste. (Although it has a couple of >nice features.) Of the KDE edito

Re: Network programming ?

2009-05-26 Thread Dave Angel
thushiantha...@gmail.com wrote: Hi everyone, I am planning to develop a chatting software in Python, for my college project. I am using Windows Vista. Is it possible to do sockets programming in Python ? Any books or websites ? Also, i want to develop a gui for that program. What are the gui to

Re: What text editor is everyone using for Python

2009-05-26 Thread Ant
On May 25, 6:35 pm, LittleGrasshopper wrote: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got I use GVim or vim if on a terminal. There are quite a few plugins and scripts I find invaluable, but most are not p

Re: unicode confusing

2009-05-26 Thread Pet
On May 26, 9:29 am, Pet wrote: > On May 25, 6:07 pm, Paul Boddie wrote: > > > > > > > On 25 Mai, 17:39, someone wrote: > > > > Hi, > > > > reading content of webpage (encoded in utf-8) with urllib2, I can't > > > get parsed data into DB > > > > Exception: > > > >   File "/usr/lib/python2.5/site-

RE: A fast way to read last line of gzip archive ?

2009-05-26 Thread Barak, Ron
Hi David, Thanks for the below solutions: most illuminating. I implemented your previous message suggestions, and already the processing time (on my datasets) is within acceptable human times. I'll try your suggestion below. Thanks again. Ron. > -Original Message- > From: David Bolen [ma

Re: What text editor is everyone using for Python

2009-05-26 Thread Hendrik van Rooyen
"Lawrence D'Oliveiro" wrote: > In message , Steven > D'Aprano wrote: > > > On Tue, 26 May 2009 18:31:56 +1200, Lawrence D'Oliveiro wrote: > > > >> In message >> b201-4b2445732...@v35g2000pro.googlegroups.com>, LittleGrasshopper > >> wrote: > >> > >>> ... I am looking for suitable syntax file

Re: What text editor is everyone using for Python

2009-05-26 Thread Piet van Oostrum
> Esmail (E) wrote: >E> LittleGrasshopper wrote: >>> >>> So what do you guys use, and why? Hopefully we can keep this civil. >E> I use Emacs, just because I have been using this editor for >E> all sorts of things in the last 20+ years. Me too. I like my tools to be programmable. -- Piet v

Re: unicode confusing

2009-05-26 Thread Paul Boddie
On 26 Mai, 10:09, Pet wrote: > > After some time, I've tried, to convert result with unicode(result, > 'ISO-8859-15') and that was it :) I haven't really investigated having unicode_results set to false (or the default) with a database containing UTF-8 (or any non-ASCII encoded) text, since it's

Re: What text editor is everyone using for Python

2009-05-26 Thread Jeremiah Dodds
On Mon, May 25, 2009 at 6:35 PM, LittleGrasshopper wrote: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got > into Python, so I am looking for suitable syntax files for it, and > extra utilities. I dabbled with

which database is suitable for small applications

2009-05-26 Thread Kalyan Chakravarthy
Hi All, can any one suggest me which database I can use for my small application(to store user names ,passwords, very few other data.. ) I am using Python, Google Apps and guide me how to connect to database, I am very new to these technologies Please help me Thanks in advance -- Rega

Re: exec statement with/without prior compile...

2009-05-26 Thread Arnaud Delobelle
"Gabriel Genellina" writes: > En Mon, 25 May 2009 11:07:13 -0300, Jaime Fernandez del Rio > escribió: >> And since I'm asking, could something similar, i.e. defining a new >> function and get a handle to it, be achieved with eval? > > No, because def is a statement, and eval only accepts an expr

How to create a list of functions depending on a parameter?

2009-05-26 Thread enzo michelangeli
Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j in range(n)] Unfortunately,

Re: What text editor is everyone using for Python

2009-05-26 Thread Steven D'Aprano
On Tue, 26 May 2009 09:58:40 +0200, Hendrik van Rooyen wrote: > "Steven D'Aprano" wrote: > >>I use kwrite when on a GUI. When I can't avoid editing files remotely >>over ssh, I use nano. >> >>Why? I dislike Gnome's user-interface, and I find gedit slightly too >>underpowered and dumbed down for

Re: 4 hundred quadrillonth?

2009-05-26 Thread Steven D'Aprano
On Mon, 25 May 2009 23:10:02 -0700, Scott David Daniels wrote: > Steven D'Aprano wrote: >> On Mon, 25 May 2009 16:21:19 +1200, Lawrence D'Oliveiro wrote: >>... (0) "Opposite" is not well-defined unless you have a dichotomy. In >>the ... (1/3) Why do you jump to the conclusion that "pi=3" implies t

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
enzo michelangeli writes: > Let's suppose I want to create a list of n functions of a single > argument, returning the sum between argument and index in the list, so > that e.g.: > > f[0](10) will return 10 > f[3](12) will return 15 > > ...and so on. I had naively though of coding: > > f = [lamb

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
enzo michelangeli schrieb: Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j

Re: What text editor is everyone using for Python

2009-05-26 Thread Steven D'Aprano
On Tue, 26 May 2009 19:23:19 +1200, Lawrence D'Oliveiro wrote: > In message , > Steven D'Aprano wrote: > >> On Tue, 26 May 2009 18:31:56 +1200, Lawrence D'Oliveiro wrote: >> >>> In message >> b201-4b2445732...@v35g2000pro.googlegroups.com>, LittleGrasshopper >>> wrote: >>> ... I am looking

Re: What text editor is everyone using for Python

2009-05-26 Thread Paul Rudin
Steven D'Aprano writes: > e.g. I can instantly tell if I neglected to close a string, because > my code displays in red. I like syntax hightlighting for whitespace related things in python. e.g to highlight tabs, or whitespace at the end of a line. -- http://mail.python.org/mailman/listinfo/py

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Paul Rudin
"Diez B. Roggisch" writes: > enzo michelangeli schrieb: >> Let's suppose I want to create a list of n functions of a single >> argument, returning the sum between argument and index in the list, so >> that e.g.: >> >> f[0](10) will return 10 >> f[3](12) will return 15 >> >> ...and so on. I had na

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Arnaud Delobelle
"Diez B. Roggisch" writes: > You need to capture n into the closure of the lambda: > > f = [lambda x, n=n: x+j for j in xrange(n)] You mean [lambda x, j=j: x+j for j in xrange(n)] Another way would be [(lambda j:lambda x: x+j)(j) for j in xrange(n)] Or more readably: def adder(n): return

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread enzo michelangeli
Thanks guys. So far I had only come out with f = [eval('lambda x: x+'+str(j)) for j in range(3)] ...which I hated because, as everybody knows, eval is evil :-) Enzo On May 26, 5:20 pm, Arnaud Delobelle wrote: > "Diez B. Roggisch" writes: > > > You need to capture n into the closure of the lam

Re: A list with periodic boundary conditions

2009-05-26 Thread youh...@googlemail.com
Rodhri, thank you very much for your reply. I've tried to extend what you suggested; I think it can be made to work, but you're right -- it gets horrid rapidly. I'm at the start of what promises to be a large project, and I want to make sure that I get my data structures right, but my impression

Re: Network programming ?

2009-05-26 Thread CTO
On May 25, 11:05 pm, thushiantha...@gmail.com wrote: > Hi everyone, > > I am planning to develop a chatting software in Python, for my college > project. I am using Windows Vista. Is it possible to do sockets > programming in Python ? Any books or websites ?  Also, i want to > develop a gui for tha

Re: Are Python-based web frameworks reliable enough?

2009-05-26 Thread Bruno Desthuilliers
Gilles Ganault a écrit : Hello Until now, the modest web apps I wrote were all in PHP because it's available on just about any hosted server. I now have a couple of ideas for applications where I would deploy my own servers, so that I'd rather write them in Python because I find the lan

Re: which database is suitable for small applications

2009-05-26 Thread Jean-Michel Pichavant
Kalyan Chakravarthy wrote: Hi All, can any one suggest me which database I can use for my small application(to store user names ,passwords, very few other data.. ) I am using Python, Google Apps and guide me how to connect to database, I am very new to these technologies Please help

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Paul Rudin wrote: > "Diez B. Roggisch" writes: > >> enzo michelangeli schrieb: >>> Let's suppose I want to create a list of n functions of a single >>> argument, returning the sum between argument and index in the list, so >>> that e.g.: >>> >>> f[0](10) will return 10 >>> f[3](12) will return 1

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Diez B. Roggisch
Arnaud Delobelle wrote: > "Diez B. Roggisch" writes: > >> You need to capture n into the closure of the lambda: >> >> f = [lambda x, n=n: x+j for j in xrange(n)] > > You mean [lambda x, j=j: x+j for j in xrange(n)] Ah, sorry, parentheses-problem. Diez -- http://mail.python.org/mailman/li

Re: What text editor is everyone using for Python

2009-05-26 Thread Lawrence D'Oliveiro
In message , Hendrik van Rooyen wrote: > "Lawrence D'Oliveiro" wrote: >> >> Why [do you want syntax highlighting]? > > It makes your screen look more busy as you type - for instance, if you > type a " or a ' then it treats the rest of the file from that point on as > belonging to the same stri

What is the difference between init and enter?

2009-05-26 Thread John
I'm okay with init, but it seems to me that enter is redundant since it appears that anything you want to execute in enter can be done in init. -- http://mail.python.org/mailman/listinfo/python-list

DB-API execute params, am I missing something?

2009-05-26 Thread Gabriel Rossetti
Hello everyone, I am trying to use dbapi with mysql and I get this error: Traceback (most recent call last): File "", line 1, in File "", line 2, in getUnitParams File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 151, in execute query = query % db.literal(args) TypeError:

Re: What is the difference between init and enter?

2009-05-26 Thread Diez B. Roggisch
John wrote: > I'm okay with init, but it seems to me that enter is redundant since it > appears that anything you want to execute in enter can be done in init. About what are you talking? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-05-26 Thread Lacrima
I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? -- http://mail.python.org/mailman/listinfo/python-list

Re: email scanning for X-Spam-Score

2009-05-26 Thread skip
Helmut>mailmsg = email.message_from_string(msg) Helmut>SPAM_CORE = mailmsg['X-Spam-Score'] Maybe lower case? SPAM_CORE = mailmsg['x-spam-score'] -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ America's vaunted "free press" notwithstanding, story ideas th

Building Python with icc on 64-bit Linux

2009-05-26 Thread Konrad Hinsen
I am trying to install Python 2.6.2 on a 64-bit Linux machine (RedHat Enterprise) using the Intel compiler (version 11). Even without optimizations (-O0), I get a compilation error in the ctypes module icc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -O0 -I. -I/home/shr/ khinsen/tm\ p/Python

Re: DB-API execute params, am I missing something?

2009-05-26 Thread Diez B. Roggisch
Gabriel Rossetti wrote: > Hello everyone, I am trying to use dbapi with mysql and I get this error: > > Traceback (most recent call last): > File "", line 1, in > File "", line 2, in getUnitParams > File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 151, > in execute > q

Re: which database is suitable for small applications

2009-05-26 Thread Tim Chase
can any one suggest me which database I can use for my small application(to store user names ,passwords, very few other data.. ) I am using Python, Google Apps and guide me how to connect to database, I am very new to these technologies Well, depending on the complexity you need, you c

Re: What text editor is everyone using for Python

2009-05-26 Thread J Kenneth King
Lacrima writes: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? That is a slightly better question. Try some of the free alternatives. I do happen to u

Re: What is the difference between init and enter?

2009-05-26 Thread Ken Seehart
Diez B. Roggisch wrote: John wrote: I'm okay with init, but it seems to me that enter is redundant since it appears that anything you want to execute in enter can be done in init. About what are you talking? Diez Presumably, the 'with' statement. http://www.python.org/dev/peps

Re: which database is suitable for small applications

2009-05-26 Thread J Kenneth King
Jean-Michel Pichavant writes: > Kalyan Chakravarthy wrote: >> Hi All, >> can any one suggest me which database I can use for my >> small application(to store user names ,passwords, very few other >> data.. ) >> I am using Python, Google Apps and guide me how to connect to >> database, I

Re: What is the difference between init and enter?

2009-05-26 Thread Lie Ryan
Diez B. Roggisch wrote: John wrote: I'm okay with init, but it seems to me that enter is redundant since it appears that anything you want to execute in enter can be done in init. About what are you talking? Diez Do you mean __init__ and __enter__? They are used for two completely diffe

Re: What text editor is everyone using for Python

2009-05-26 Thread Jean-Michel Pichavant
Why buy an IDE when you just need a text editor ? I don't get it. Anyway gvim (aka vim aka vi) and emacs are the most powerful editors for years. Both have Windows and Linux version and most important, they both are very effective at editing any file type (python, C, latex, love letters...) Ema

Re: What text editor is everyone using for Python

2009-05-26 Thread Roy Smith
In article , "Hendrik van Rooyen" wrote: > [syntax coloring] makes your screen look more busy as you type - for > instance, if you > type a " or a ' then it treats the rest of the file from that point on as > belonging to the same string you are about to start typing, and colours it > all usin

Re: What text editor is everyone using for Python

2009-05-26 Thread Ken Seehart
Lacrima wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? It's my favorite. Buy it. I'm not aware of any better choices. If you can afford the Pro ver

Re: Regarding sort()

2009-05-26 Thread Scott David Daniels
Jaime Fernandez del Rio wrote: ... the reasons are starting to pile to fare 2.6 goodbye and move on to 3.0... If you wait just a bit (TM)*, you'd be better served to move on to 3.1. I think 3.0 is for learning, both for Python developers and users, and has less "fit and polish" than previous Py

Re: which database is suitable for small applications

2009-05-26 Thread Mike Driscoll
On May 26, 8:16 am, J Kenneth King wrote: > Jean-Michel Pichavant writes: > > Kalyan Chakravarthy wrote: > >> Hi All, > >>           can any one suggest me which database I can use for my > >> small application(to store user names ,passwords, very few other > >> data.. ) > >> I am using Python, G

Re: What text editor is everyone using for Python

2009-05-26 Thread Mel
LittleGrasshopper wrote: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got > into Python, so I am looking for suitable syntax files for it, and > extra utilities. I dabbled with emacs at some point, but couldn't

Re: What text editor is everyone using for Python

2009-05-26 Thread Arnaud Delobelle
Lawrence D'Oliveiro writes: > In message , Hendrik van > Rooyen wrote: > >> "Lawrence D'Oliveiro" wrote: >>> >>> Why [do you want syntax highlighting]? >> >> It makes your screen look more busy as you type - for instance, if you >> type a " or a ' then it treats the rest of the file from that

Re: How to create a list of functions depending on a parameter?

2009-05-26 Thread Scott David Daniels
enzo michelangeli wrote: Let's suppose I want to create a list of n functions of a single argument, returning the sum between argument and index in the list, so that e.g.: f[0](10) will return 10 f[3](12) will return 15 ...and so on. I had naively though of coding: f = [lambda x: x+j for j in

large array in a single line

2009-05-26 Thread karthik167
I would like to have a txt file of single line with [1 2 3 .100] I try something like q=arange(100) fl=file('tmp.ext','w') fl.writelines(str(q)) fl.close() Unfortunately my output is [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 3

Re: large array in a single line

2009-05-26 Thread Ken Seehart
Arnaud Delobelle wrote: karthik...@gmail.com writes: I would like to have a txt file of single line with [1 2 3 .100] I try something like q=arange(100) fl=file('tmp.ext','w') fl.writelines(str(q)) fl.close() Unfortunately my output is [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

How to test python snippets in my documents?

2009-05-26 Thread Matthew Wilson
I'm using a homemade script to verify some code samples in my documentation. Here it is: #! /usr/bin/env python2.6 # vim: set expandtab ts=4 sw=4 filetype=python: import doctest, os, sys def main(s): "Run doctest.testfile(s, None)" return doctest.testfile(s, No

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-26 Thread Martin v. Löwis
> Now, with the PEP, I have a feeling that the Python C-API > will in effect be limited to what's in the PEP's idea of > a usable ABI and open up the non-inluded public C-APIs > to the same rate of change as the private APIs. That's certainly not the plan. Instead, the plan is to have a stable ABI

scripting and uploading in Python

2009-05-26 Thread Mark Tarver
I've recently purchased a site on a Linux server which runs Python. Generally I'd like to bring myself up to speed on scripting in Python. Any good reads - dead tree or otherwise? One thing I need to learn is to be able to give folks the power to upload files onto their own disk space using pas

Re: What text editor is everyone using for Python

2009-05-26 Thread Ken Seehart
Lacrima wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? Jean-Michel Pichavant wrote: Why buy an IDE when you just need a text editor ? I don't get i

Re: What text editor is everyone using for Python

2009-05-26 Thread Zamnedix
On May 25, 10:35 am, LittleGrasshopper wrote: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got > into Python, so I am looking for suitable syntax files for it, and > extra utilities. I dabbled with emacs at som

Re: What text editor is everyone using for Python

2009-05-26 Thread Benjamin Kaplan
On Tue, May 26, 2009 at 8:07 AM, Lacrima wrote: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? We're mostly talking about text editors, not full-fledge

Re: large array in a single line

2009-05-26 Thread Dave Angel
karthik...@gmail.com wrote: I would like to have a txt file of single line with [1 2 3 .100] I try something like q=arange(100) fl=file('tmp.ext','w') fl.writelines(str(q)) fl.close() Unfortunately my output is [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Re: What text editor is everyone using for Python

2009-05-26 Thread Bar Shirtcliff
Ken Seehart writes: | | Lacrima wrote: | > I am new to python. | > And now I am using trial version of Wing IDE. | > But nobody mentioned it as a favourite editor. | > So should I buy it when trial is expired or there are better choices? | > | | I've heard notepad is pretty good. http://www.

Re: Network programming ?

2009-05-26 Thread Benjamin Kaplan
On Tue, May 26, 2009 at 4:00 AM, Dave Angel wrote: > thushiantha...@gmail.com wrote: > >> Hi everyone, >> >> I am planning to develop a chatting software in Python, for my college >> project. I am using Windows Vista. Is it possible to do sockets >> programming in Python ? Any books or websites ?

Re: large array in a single line

2009-05-26 Thread Robert Kern
On 2009-05-26 09:18, karthik...@gmail.com wrote: I would like to have a txt file of single line with [1 2 3 .100] I try something like q=arange(100) fl=file('tmp.ext','w') fl.writelines(str(q)) fl.close() Unfortunately my output is [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Re: large array in a single line

2009-05-26 Thread karthik167
On May 26, 7:26 pm, Arnaud Delobelle wrote: > karthik...@gmail.com writes: > > I would like to have a txt file of single line with > > [1 2 3 .100] > > > I try something like > > q=arange(100) > > fl=file('tmp.ext','w') > > fl.writelines(str(q)) > > fl.close() > > > Unfortunately my output

Re: What text editor is everyone using for Python

2009-05-26 Thread Tim Chase
Zamnedix wrote: So what do you guys use, and why? Hopefully we can keep this civil. Nano! Nano! Nano Revolution!!! Thank you, Mork[1] :) -tkc (who uses Vim for Python coding, and on rare occasions, Notepad or ed) [1] http://en.wikipedia.org/wiki/Mork_%26_Mindy -- http://mail.python.o

Re: large array in a single line

2009-05-26 Thread Arnaud Delobelle
karthik...@gmail.com writes: > On May 26, 7:26 pm, Arnaud Delobelle wrote: >> karthik...@gmail.com writes: >> > I would like to have a txt file of single line with >> > [1 2 3 .100] >> >> > I try something like >> > q=arange(100) >> > fl=file('tmp.ext','w') >> > fl.writelines(str(q)) >> >

Re: Optimizing math functions

2009-05-26 Thread Robert Kern
On 2009-05-24 07:42, Esmail wrote: Robert Kern wrote: We have several bounded optimization routines in scipy. http://docs.scipy.org/doc/scipy/reference/optimize.html Hi Robert, Thanks for the lead .. I briefly looked at the documentation, but before I dig into this more deeply 2 quick ques

Re: which database is suitable for small applications

2009-05-26 Thread Kushal Kumaran
On Tue, May 26, 2009 at 2:03 PM, Kalyan Chakravarthy wrote: > Hi All, >   can any one suggest me which database I can use for my small > application(to store user names ,passwords, very few other data.. ) > I am using Python, Google Apps and guide me how to connect to database, I am > very

Re: What text editor is everyone using for Python

2009-05-26 Thread Benjamin Kaplan
On Tue, May 26, 2009 at 11:17 AM, Ken Seehart wrote: > > Lacrima wrote: > >> I am new to python. >> And now I am using trial version of Wing IDE. >> But nobody mentioned it as a favourite editor. >> So should I buy it when trial is expired or there are better choices? >> >> > > Jean-Michel Pichav

Re: How to test python snippets in my documents?

2009-05-26 Thread Lie Ryan
Matthew Wilson wrote: I'm using a homemade script to verify some code samples in my documentation. Here it is: #! /usr/bin/env python2.6 # vim: set expandtab ts=4 sw=4 filetype=python: import doctest, os, sys def main(s): "Run doctest.testfile(s, None)" retur

Re: Network programming ?

2009-05-26 Thread thushianthan15
Thank you, for all your support. I will try wxPython with the sockets module. thushanthan. -- http://mail.python.org/mailman/listinfo/python-list

Re: replacement for execfile

2009-05-26 Thread Scott David Daniels
Alex Popescu wrote: "Steven D'Aprano" wrote in news:pan.2007.07.29.03.39.34.703...@remove.this.cybersource.com.au: ... you're expecting the users to write working Python code, but you think "import module" is too hard for them? That was just a cherry on the cake. The most important part is t

Re: What is the difference between init and enter?

2009-05-26 Thread Gary Herron
John wrote: I'm okay with init, but it seems to me that enter is redundant since it appears that anything you want to execute in enter can be done in init. The proper response to a question like this has to be http://www.catb.org/~esr/faqs/smart-questions.html as anything else is complete g

Re: large array in a single line

2009-05-26 Thread Arnaud Delobelle
karthik...@gmail.com writes: > I would like to have a txt file of single line with > [1 2 3 .100] > > I try something like > q=arange(100) > fl=file('tmp.ext','w') > fl.writelines(str(q)) > fl.close() > > Unfortunately my output is > > [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Re: What text editor is everyone using for Python

2009-05-26 Thread David Smith
Lacrima wrote: > I am new to python. > And now I am using trial version of Wing IDE. > But nobody mentioned it as a favourite editor. > So should I buy it when trial is expired or there are better choices? I use Wing IDE and like it. It very nicely enforces consistent space indentations and othe

Re: How to test python snippets in my documents?

2009-05-26 Thread Ned Deily
In article , Matthew Wilson wrote: > I'm using a homemade script to verify some code samples in my > documentation. [...] > The script checks all the files listed as arguments. This is OK, but is > there anything better? Perhaps a test-discovery framework, like nose: http://ivory.idyll.org/ar

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-26 Thread M.-A. Lemburg
Martin v. Löwis wrote: >> Now, with the PEP, I have a feeling that the Python C-API >> will in effect be limited to what's in the PEP's idea of >> a usable ABI and open up the non-inluded public C-APIs >> to the same rate of change as the private APIs. > > That's certainly not the plan. Instead, t

test message

2009-05-26 Thread Joel Goldstick
I'm wondering why I couldn't post here. I read the email list, not from the newsgroup -- http://mail.python.org/mailman/listinfo/python-list

Re: Ted Dziuba

2009-05-26 Thread John DeRosa
On 2009-05-25 00:22:04 -0700, Lawrence D'Oliveiro said: : If you've ever had to build C extensions to Python on Windows, you can join me in a feeling of satisfaction that someone at Microsoft is going to have

multiprocessing / forking memory usage

2009-05-26 Thread Randall Smith
I'm trying to get a grasp on how memory usage is affected when forking as the multiprocessing module does. I've got a program with a parent process using wx and other memory intensive modules. It spawns child processes (by forking) that should be very lean (no wx required, etc). Based on inspe

Passing string from python programs to external programs

2009-05-26 Thread lone_eagle
Hi all, On Linux, I do something like this $ program_to_execute < input_file ... get some output ... I have the content of the input_file as a string inside a python program and would like to pass this string to the external program from inside the python program and get back the programs output

How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Sumitava Mukherjee
Hi all, I need to randomly sample from a list where all choices have weights attached to them. The probability of them being choosen is dependent on the weights. If say Sample list of choices are [A,B,C,D,E] and weights of the same are [0.895,0.567,0.765,0.890,0.60] when I draw (say 2) samples then

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Sumitava Mukherjee
On May 26, 11:39 pm, Sumitava Mukherjee wrote: > Hi all, > I need to randomly sample from a list where all choices have weights > attached to them. The probability of them being choosen is dependent > on the weights. > If say Sample list of choices are [A,B,C,D,E] and weights of the same > are [0.

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Emile van Sebille
On 5/26/2009 11:39 AM Sumitava Mukherjee said... Hi all, I need to randomly sample from a list where all choices have weights attached to them. The probability of them being choosen is dependent on the weights. If say Sample list of choices are [A,B,C,D,E] and weights of the same are [0.895,0.567

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Arnaud Delobelle
Sumitava Mukherjee writes: > On May 26, 11:39 pm, Sumitava Mukherjee wrote: >> Hi all, >> I need to randomly sample from a list where all choices have weights >> attached to them. The probability of them being choosen is dependent >> on the weights. >> If say Sample list of choices are [A,B,C,D,

Re: [Python-Dev] PEP 384: Defining a Stable ABI

2009-05-26 Thread Martin v. Löwis
Functions declared in the following header files are not part of the ABI: - cellobject.h - classobject.h - code.h - frameobject.h - funcobject.h - genobject.h - pyarena.h - pydebug.h - symtable.h - token.h - traceback.h >>> I don't th

Re: Passing string from python programs to external programs

2009-05-26 Thread CTO
On May 26, 2:12 pm, lone_eagle wrote: > Hi all, > > On Linux, I do something like this > > $ program_to_execute < input_file > ... get some output ... > > I have the content of the input_file as a string inside a python > program and would like to pass this string to the external program > from in

Re: What text editor is everyone using for Python

2009-05-26 Thread Brian Blais
On May 26, 2009, at 11:17 , Ken Seehart wrote: Lacrima wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? Jean-Michel Pichavant wrote: Why buy an IDE w

Re: What text editor is everyone using for Python

2009-05-26 Thread Brian Blais
On May 26, 2009, at 8:07 , Lacrima wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? I have found that the appreciation of a text editor varies greatly

Re: Compile python extensions under windows/cygwin

2009-05-26 Thread Joshua Kugler
Joana wrote: > I mantain Python on Windows, all installed packages are under c: > \Python25\Lib\site-packages. Now I have to build C libraries used by > python extensions and I am using cygwin, but I don't know how to > install the module in Windows directory. I have used MingW to do this. Might

Re: Passing string from python programs to external programs

2009-05-26 Thread Jeff McNeil
On May 26, 2:12 pm, lone_eagle wrote: > Hi all, > > On Linux, I do something like this > > $ program_to_execute < input_file > ... get some output ... > > I have the content of the input_file as a string inside a python > program and would like to pass this string to the external program > from in

Pickle of the instance of new style class fails when execute with exec statement

2009-05-26 Thread Борис Казаков
Hi, I'm trying to execute the following code: d = {} exec('import cPickle') in d desc = """ class A(object): pass """ exec(desc) in d exec('a = A()') in d exec('cPickle.dump(a, open("tmp.txt","wb"))')in d for some reason it fails with the following traceback: Traceback (most recent call la

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread George Sakkis
On May 26, 2:39 pm, Sumitava Mukherjee wrote: > Hi all, > I need to randomly sample from a list where all choices have weights > attached to them. The probability of them being choosen is dependent > on the weights. > If say Sample list of choices are [A,B,C,D,E] and weights of the same > are [0.8

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Mel
Sumitava Mukherjee wrote: > Hi all, > I need to randomly sample from a list where all choices have weights > attached to them. The probability of them being choosen is dependent > on the weights. > If say Sample list of choices are [A,B,C,D,E] and weights of the same > are [0.895,0.567,0.765,0.890

unpickling a stream

2009-05-26 Thread msolem
Hello, I want to send a stream of pickled objects over a socket. Is there a standard way of ensuring that only complete objects are unpickled on the receiving side. client pseudo code: loop forever: receive some bytes on the socket if we have received a complete pickled object: <== Ho

Re: How do I sample randomly based on some probability(wightage)?

2009-05-26 Thread Dave Angel
Sumitava Mukherjee wrote: Hi all, I need to randomly sample from a list where all choices have weights attached to them. The probability of them being choosen is dependent on the weights. If say Sample list of choices are [A,B,C,D,E] and weights of the same are [0.895,0.567,0.765,0.890,0.60] when

distutils extension configuration problem

2009-05-26 Thread Ron Garret
I'm trying to build PyObjC on an Intel Mac running OS X 10.5.7. The build is breaking because distutils seems to want to build extension modules as universal binaries, but some of the libraries it depends on are built for intel-only, i.e.: [...@mickey:~/Desktop/pyobjc-framework-ScreenSaver-2.2

Re: multiprocessing / forking memory usage

2009-05-26 Thread Piet van Oostrum
> Randall Smith (RS) wrote: >RS> I'm trying to get a grasp on how memory usage is affected when forking as >RS> the multiprocessing module does. I've got a program with a parent process >RS> using wx and other memory intensive modules. It spawns child processes (by >RS> forking) that should

  1   2   >