Re: profiling memory usage

2006-10-06 Thread NOSHII
> Hi, > > I am looking for a method to profile memory usage in my python program. > The program provides web service and therefore is intended to run for a > long time. However, the memory usage tends to increase all the time, > until in a day or two the system cannot handle it any more and start

Re: Strange sorting error message

2006-10-06 Thread Neil Cerutti
On 2006-10-06, hanumizzle <[EMAIL PROTECTED]> wrote: > On 10/5/06, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> It was a joke, based on you hiding what you are doing, he decided >> to hide the solution to your problem. Get it? > > What if it was for a proprietary software of some kind? It wasn't s

hiiii

2006-10-06 Thread NOSHII
Salmaan (R.A.) reports, "On the last day of Sha'baan Rasulullah(SAW) addressed us & said, '0! people there comes over u now a great month, a most blessed month in which lies a night more greater in virtue than a 1000 months. It is a month in which Allah has made Fasting compulsory by day. And has m

Re: Python to use a non open source bug tracker?

2006-10-06 Thread Phillip J. Eby
Giovanni Bajo wrote: > I am seriously concerned > that the PSF infrastructure committee EVER considered non open-source > applications for this. In fact, I thought that was an implicit requirement in > the selection. The goal of the selection process is to support the work of the Python developers

Re: Recursive descent algorithm able to parse Python?

2006-10-06 Thread Piet van Oostrum
> "Diez B. Roggisch" <[EMAIL PROTECTED]> (DBR) wrote: >DBR> http://en.wikipedia.org/wiki/Recursive_descent_parser >DBR> """ >DBR> Recursive descent with backup is a technique that determines which >DBR> production to use by trying each production in turn. Recursive >DBR> descent with backup i

Re: extract certain values from file with re

2006-10-06 Thread johnzenger
Can you safely assume that the lines you want to extract all contain numbers, and that the lines you do not wish to extract do not contain numbers? If so, you could just use the Linux grep utility: "grep '[0123456789]' filename" Or, in Python: import re inf = file("your-filename-here.txt") outf

Bug in re module?

2006-10-06 Thread Ant
Look at the following minimal example: >>> import re >>> p = re.compile(r"(:?Test) (String)") >>> m = p.search("This is a Test String OK?") >>> m.groups() ('Test', 'String') I would have expected this to produce: ('String') since (:?...) should be a non-capturing group. From the module referenc

Debugging question: Print out program state (Variables)

2006-10-06 Thread Josh Bloom
Hello PyListers, I have a python script that runs nightly and fetches info from various webservers and does some processing on the data. Occasionally my script has a problem and is unable to finish its work. I have try blocks and logging for most of the errors that can happen. What I would like to

Re: Bug in re module?

2006-10-06 Thread Ant
Ant wrote: > Look at the following minimal example: ... (snip example that shows non-capturing group capturing) Note I get the same results from python versions 2.4 and 2.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re module?

2006-10-06 Thread Fredrik Lundh
Ant wrote: > > I would have expected this to produce: > > ('String') > > since (:?...) should be a non-capturing group. From the module > reference: > > (?:...) (?:...) isn't the same thing as (:?...), though. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re module?

2006-10-06 Thread Just
In article <[EMAIL PROTECTED]>, "Ant" <[EMAIL PROTECTED]> wrote: > Ant wrote: > > Look at the following minimal example: > ... (snip example that shows non-capturing group capturing) > > Note I get the same results from python versions 2.4 and 2.5. > Try ?: instead of :? Just -- http://mail.

Re: Bug in re module?

2006-10-06 Thread John Machin
Ant wrote: > Look at the following minimal example: > > >>> import re > >>> p = re.compile(r"(:?Test) (String)") Bzt! Sorry, PBKAC. The correct syntax is (?:foo) You have (:?foo) which matches an optional colon followed by foo. Now quick kill your post before the effbot spots it :-) > >>>

Re: help on pickle tool

2006-10-06 Thread Josh Bloom
If you must build your web ui in Java, then Jython is probably the best way for you to go. Inside of your java code you need to create a Jython instance. Then you can use the Jython pickle module to deserialize the data you are receiving. Last I remember Jython was equivalent to about CPython 2.2

Re: Bug in re module?

2006-10-06 Thread Ant
Just wrote: > Try ?: instead of :? Duh. Put it down to Friday afternoon! :-\ Don't know what I was thinking that something as high profile as that could slip through the net!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in re module?

2006-10-06 Thread Ant
John Machin wrote: > Now quick kill your post before the effbot spots it :-) Too late - the post was 3 minutes ago you know ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic import PEP

2006-10-06 Thread Dan Bishop
On Sep 22, 10:09 pm, Connelly Barnes <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote the 'autoimp' module [1], which allows you to import lazy modules: > > from autoimp import * (Import lazy wrapper objects around all modules; > "lazy >modules" will turn into normal mo

Re: switching to numpy and failing, a user story

2006-10-06 Thread Istvan Albert
sturlamolden wrote: > Those involved in the development of NumPy must receive some > compensation. Financial support to NumPy also ensure that the > developmentcan continue. I for one does not want to see NumPy as Then charge for NumPy ... or write a book *besides* the documentation. One in which

Re: Bug in re module?

2006-10-06 Thread Bruno Desthuilliers
Ant wrote: > John Machin wrote: > >> Now quick kill your post before the effbot spots it :-) > > Too late - the post was 3 minutes ago you know ;-) > Must be your lucky day - he did spot it, and you're still alive !-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w i

Re: Bug in re module?

2006-10-06 Thread Bruno Desthuilliers
Ant wrote: > John Machin wrote: > >> Now quick kill your post before the effbot spots it :-) > > Too late - the post was 3 minutes ago you know ;-) > +1 QOTW, BTW -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')

Re: extract certain values from file with re

2006-10-06 Thread bearophileHUGS
Fabian Braennstroem: > A more difficult log file looks like: > ... > With my sed/awk/grep/gnuplot script I would extract the > values in the 'U-Mom' row using grep and print a certain > column (e.g. 'Max Res') to a file and print it with gnuplot. > Maybe I have to remove those '|' using sed before.

Re: Ctypes and freeing memory

2006-10-06 Thread Thomas Heller
Oliver Andrich schrieb: > Hi everybody, > > I am currently playing around with ctypes and a C library (libWand > from ImageMagick), and as I want to easily deploy it on Mac, Linux and > Windows, I prefer a ctypes solution over a C module. At least on > windows, I would have resource problems to co

Re: extract certain values from file with re

2006-10-06 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: Use his solution like: datafile = open(data_file_name, 'r') for line in datafile: if 'U-Mom' in line: print float(line.split("|")[4]) datafile.close() For the earlier problem: def data_specific(source): global headin

Re: Google breaks Usenet (was Re: How can I correct an error in an old post?)

2006-10-06 Thread Blair P. Houghton
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Bryan Olson <[EMAIL PROTECTED]> wrote: > >Blair P. Houghton wrote: > >> > >> But they do about 10 things totally wrong with Google groups that > >> I'd've fixed in my spare time in my first week if they'd hired me back > >> when I was interviewing wi

Re: Automatic import PEP

2006-10-06 Thread Georg Brandl
Dan Bishop wrote: > On Sep 22, 10:09 pm, Connelly Barnes <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I wrote the 'autoimp' module [1], which allows you to import lazy modules: >> >> from autoimp import * (Import lazy wrapper objects around all modules; >> "lazy >>module

Re: Google breaks Usenet (was Re: How can I correct an error in an old post?)

2006-10-06 Thread Fredrik Lundh
Blair P. Houghton wrote: > "show me the message from 1987 or 1988 written by dickie > sexton where he invents the '(*plonk*)' meme" behavior, these days, you use wikipedia for things like that. -- http://mail.python.org/mailman/listinfo/python-list

Need array help

2006-10-06 Thread Marion Long Jr
I am switching from microsoft visual basic programming to python programming. In microsoft visual basic you can Dim a variable so that you can add variables by changing the number on the end of the variable as in the following example; Dim acct(100) numoffiles=4 data=10 ct=1 while ct <> numoffi

Re: Subclassing built-in classes

2006-10-06 Thread MonkeeSage
On Oct 6, 4:58 am, Maric Michaud <[EMAIL PROTECTED]> wrote: > As the first post said "...couldn't python (in theory)...", I was discussing > if it would be possible for python (in some future version) to manage the > literals so that they use the constructors in the __builtin__ module, I > didn't

Re: Google breaks Usenet (was Re: How can I correct an error in an old post?)

2006-10-06 Thread Bryan Olson
Aahz wrote: > The problem is the network effect. In this case, what Google has that > can't be replicated is the history of posts. There's no magic there. Get them the same way Google and Dejanews got them, plus you might scrape Google, from some locality with favorable laws. -- --Bryan -- ht

Re: Need array help

2006-10-06 Thread [EMAIL PROTECTED]
Marion, I think you should start with the tutorials. To access an array in Python, use brackets not parens. so, instead of "acctfile(ct) = data" try "acctfile[ct] = data". The tutorials are excellent and if you are learning from vb, you can go through them pretty quickly. On Oct 6, 10:25 am, "Ma

Re: PyXML not supported, what to use next?

2006-10-06 Thread uche . ogbuji
Paul Watson wrote: > It would appear that xml.dom.minidom or xml.sax.* might be the best > thing to use since PyXML is going without support. Best of all it is > included in the base Python distribution, so no addition hunting required. FWIW, easy_install [1] is making things so that more and mor

Re: Need array help

2006-10-06 Thread Larry Bates
Marion Long Jr wrote: > I am switching from microsoft visual basic programming to python > programming. In microsoft > visual basic you can Dim a variable so that you can add variables by > changing the number > on the end of the variable as in the following example; > > Dim acct(100) > > numof

humble coin head or tail game script I wrote

2006-10-06 Thread Camellia
Hi there this is an easy game which was inspired from my psychology class. I'll get 5/10 right prediction of your guess of head and tail at most time. If you could copy the code and run it that would be great:) code: --- # Head or Tail # # Get a list which contains 10 values f

Re: Need array help

2006-10-06 Thread John Henry
Others posted answer to your question. If you are serious about programming in Python, I highly recommend that you don't try to think in terms of "I did this in Visual Basic, how do I do this in Python". You'll end up with Python code that are nothing but a VB look alike. As recommended by oth

Re: Google breaks Usenet (was Re: How can I correct an error in an old post?)

2006-10-06 Thread Bryan Olson
Blair P. Houghton wrote: > Usenet isn't just the "send this message to all leaf nodes via tree" > behavior, > it's the "show me the message from 1987 or 1988 written by dickie > sexton where > he invents the '(*plonk*)' meme" behavior, and a lot of others. That makes Google the only non-broken Use

Re: File I/O

2006-10-06 Thread uche . ogbuji
Ant wrote: > Kirt wrote: > ... > > i dont wanna parse the xml file.. > > > > Just open the file as: > > > > f=open('test.xml','a') > > > > and append a line "abc" before tag > > The other guys are right - you should look at something like > ElementTree which makes this sort of thing pretty easy,

News on versions modules for Python-2.5?

2006-10-06 Thread M�ta-MCI
Hi, all! Any news, on release Python-2.5 for many modules/lib? Some exemples: Console (Effbot) SciPy Iconvcodec DirectPython SendKeys Dislin PyGame Twain etc. And who can confirm that these modules are independent of Python version? ReportLab Pyrex

Re: Need array help

2006-10-06 Thread Robert Kern
Larry Bates wrote: > If you want to > do vector math or matrix-type calculations look at the > array module. The array module in the standard library does not provide such capabilities. If you need them, look at numpy. http://numpy.scipy.org -- Robert Kern "I have come to believe that the

Re: humble coin head or tail game script I wrote

2006-10-06 Thread Oxyd
Um... It looks to me like it just counts the number of times you entered 't'... -- http://mail.python.org/mailman/listinfo/python-list

Re: humble coin head or tail game script I wrote

2006-10-06 Thread Camellia
Well...It' doesn't, have you run it yet? its hypothesis is people don't predict a set of things randomly. Oxyd wrote: > Um... It looks to me like it just counts the number of times you > entered 't'... -- http://mail.python.org/mailman/listinfo/python-list

Rich text processor component

2006-10-06 Thread Jorge Vilela
Hello, do anyone know if exists anything about rich text processor in python, as a component or good tutorial about it?Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive descent algorithm able to parse Python?

2006-10-06 Thread Diez B. Roggisch
Lawrence D'Oliveiro schrieb: > In message <[EMAIL PROTECTED]>, Diez B. Roggisch wrote: > >> I have to admit that I have difficulties to compare LR(k) to recursive >> descent, but the fact that the latter contains backtracking makes it at >> least more powerful than LL(k) > > LR(k) is more powerfu

Re: switching to numpy and failing, a user story

2006-10-06 Thread Scott David Daniels
Istvan Albert wrote: > sturlamolden wrote: > >> Those involved in the development of NumPy must receive some >> compensation. Financial support to NumPy also ensure that the >> developmentcan continue. I for one does not want to see NumPy as > > Then charge for NumPy ... or write a book *besides*

Re: Trying to find a elements Xpath and store it as a attribute

2006-10-06 Thread uche . ogbuji
provowallis wrote: > Hi all, > > I've been struggling with this for a while so I'm hoping that someone > could point me in the right direction. Here's my problem: I'm trying to > get the XPath for a given node in my document and then store that XPath > as an attribute of the element itself. If anyo

Re: Re: Ctypes and freeing memory

2006-10-06 Thread Oliver Andrich
On 10/6/06, Thomas Heller <[EMAIL PROTECTED]> wrote: > Chris Mellon has already pointed out a possible solution, but there is also a > different way. You could use a subclass of c_char_p as the restype > attribute: > > class String(c_char_p): > def __del__(self): > MagickRelinquishMemo

Re: How can I correct an error in an old post?

2006-10-06 Thread Paul Boddie
Tim Roberts wrote: > > Although it might be mirrored on a web site somewhere, this is a Usenet > newsgroup. It is impossible to "close" a thread. The concept simply does > not exist. Apparently, the fashionable approach to "closing a thread" is to post a critique of thread contributors to one's

Re: Need array help

2006-10-06 Thread Paul McGuire
"Marion Long Jr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am switching from microsoft visual basic programming to python >programming. Also, in anticipation of one of the most FA'ed Q's among VB->Python migrators, you must always include the parens after a function name to

Re: extract certain values from file with re

2006-10-06 Thread Paul McGuire
"Fabian Braennstroem" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I would like to remove certain lines from a log files. I had > some sed/awk scripts for this, but now, I want to use python > with its re module for this task. > > Actually, I have two different log files.

Re: News on versions modules for Python-2.5?

2006-10-06 Thread Thomas Heller
Méta-MCI schrieb: > Hi, all! > > > Any news, on release Python-2.5 for many modules/lib? > Some exemples: > > Console (Effbot) > SciPy > Iconvcodec > DirectPython > SendKeys > Dislin > PyGame > Twain > etc. > > > And who can confirm that these modules are in

Re: Ctypes and freeing memory

2006-10-06 Thread Thomas Heller
Oliver Andrich schrieb: > On 10/6/06, Thomas Heller <[EMAIL PROTECTED]> wrote: >> Chris Mellon has already pointed out a possible solution, but there is also a >> different way. You could use a subclass of c_char_p as the restype >> attribute: >> >> class String(c_char_p): >> def __del__(self)

Re: Need array help

2006-10-06 Thread Larry Bates
Robert Kern wrote: > Larry Bates wrote: > >> If you want to >> do vector math or matrix-type calculations look at the >> array module. > > The array module in the standard library does not provide such > capabilities. If you need them, look at numpy. > > http://numpy.scipy.org > I stand corre

Re: help on pickle tool

2006-10-06 Thread Paddy
hanumizzle wrote: > On 5 Oct 2006 22:25:58 -0700, Paddy <[EMAIL PROTECTED]> wrote: > > > You might try picking the data with a different pickle formatter that > > your Java can use. Maybe an XML pickler > > (http://www.gnosis.cx/download/Gnosis_Utils.More/Gnosis_Utils-1.2.1.ANNOUNCE > > untested b

Re: ctypes and setjmp

2006-10-06 Thread Thomas Heller
Richard Jones schrieb: > Currently ctypes can't play well with any C code that requires use of setjmp > as part of its API. > > libpng is one of those libraries. > > Can anyone think of a reasonable solution to this? Perhaps ctypes might be > patched to offer setjmp support in foreign function de

Re: ctypes, arrays and pointers

2006-10-06 Thread Thomas Heller
Richard Jones schrieb: > Does anyone know how to do the equivalent of this using ctypes? > > image_data = malloc(width * height * components); > row_pointers = png_get_rows(png_ptr, info_ptr); > for (y = 0; y < height; y++) > memcpy(&image_data[width * components * y], >

Re: switching to numpy and failing, a user story

2006-10-06 Thread Ramon Diaz-Uriarte
On 6 Oct 2006 09:26:23 -0700, Istvan Albert <[EMAIL PROTECTED]> wrote: > sturlamolden wrote: > > > Those involved in the development of NumPy must receive some > > compensation. Financial support to NumPy also ensure that the > > developmentcan continue. I for one does not want to see NumPy as > >

Re: help on pickle tool

2006-10-06 Thread Paddy
Paddy wrote: > hanumizzle wrote: > > On 5 Oct 2006 22:25:58 -0700, Paddy <[EMAIL PROTECTED]> wrote: > > > > > You might try picking the data with a different pickle formatter that > > > your Java can use. Maybe an XML pickler > > > (http://www.gnosis.cx/download/Gnosis_Utils.More/Gnosis_Utils-1.2.

Re: Graph Theory

2006-10-06 Thread diffuser78
Is there any documentation avaialbe for networkx ? I want to have an implementation of random graphs including watts and strogatz graph. [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > Thanks for your quick reply. Since I have not read the documentation, I > > was wondering if you can gene

Iterating over marshal

2006-10-06 Thread Tim Lesher
I'm using the marshal library to unmarshal a file containing one or more objects. The canonical way seems to be: objs = [] while 1: try: objs.append(marshal.load(fobj)) except EOFError: break Maybe it's just me, but it seems as if this should be iterable. I can get the b

n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Peter Maas
I have noticed that in the language shootout at shootout.alioth.debian.org the Python program for the n-body problem is about 50% slower than the Perl program. This is an unusual big difference. I tried to make the Python program faster but without success. Has anybody an explanation for the differ

psycopg: tz import error

2006-10-06 Thread km
Hi all,i have python 2.4.3 and 2.5 versions installed default python interpreter being  2.5have compiled psycopg2 with python2.4.3 setup.py.install , it installs in site-setup of 2.4.3 but when i login as a normal user and get into interctive python prompt of 2.4.3 ,  and " import tz " fails to im

Re: extract certain values from file with re

2006-10-06 Thread Paddy
Fabian Braennstroem wrote: > Hi, > > > I actually want to extract the lines with the numbers, write > them to a file and finally use gnuplot for plotting them. A > nicer and more python way would be to extract those numbers, > write them into an array according to their column and plot > t

Dumping the state of a deadlocked process

2006-10-06 Thread andre . naess
Hi all I'm currently having some issues with a process getting deadlocked. The problem is that the only way I can seem to find information about where it deadlocks is by making a wild guess, insert a pdb.set_trace() before this point, and then step until it locks up, hoping that I've guessed right

error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
hi all, i'm starting to put together a program to simulate the performance of an investment portfolio in a monte carlo manner doing x thousand iterations and extracting data from the results. i'm still in the early stages, and am trying to code something simple and interactive to get the percenta

Re: extract certain values from file with re

2006-10-06 Thread Matteo
Fabian Braennstroem wrote: > Hi, > > I would like to remove certain lines from a log files. I had > some sed/awk scripts for this, but now, I want to use python > with its re module for this task. > > Actually, I have two different log files. The first file looks > like: > >... >'some text'

Re: Graph Theory

2006-10-06 Thread bearophileHUGS
[EMAIL PROTECTED]: > Is there any documentation avaialbe for networkx ? I want to have an > implementation of random graphs including watts and strogatz graph. Try reading the code, often it's simple enough. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over marshal

2006-10-06 Thread Fredrik Lundh
Tim Lesher wrote: > I'm using the marshal library to unmarshal a file containing one or > more objects. The canonical way seems to be: > > objs = [] > while 1: > try: > objs.append(marshal.load(fobj)) > except EOFError: > break the canonical way to do this is to put the

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread John J. Lee
Peter Maas <[EMAIL PROTECTED]> writes: > I have noticed that in the language shootout at shootout.alioth.debian.org > the Python program for the n-body problem is about 50% slower than the Perl > program. This is an unusual big difference. I tried to make the Python program > faster but without su

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread bearophileHUGS
Peter Maas: > I have noticed that in the language shootout at shootout.alioth.debian.org > the Python program for the n-body problem is about 50% slower than the Perl > program. This is an unusual big difference. I tried to make the Python program > faster but without success. Has anybody an explan

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread skip
Peter> I have noticed that in the language shootout at Peter> shootout.alioth.debian.org the Python program for the n-body Peter> problem is about 50% slower than the Perl program. This is an Peter> unusual big difference. I tried to make the Python program faster Peter> but wi

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Neil Cerutti
On 2006-10-06, Peter Maas <[EMAIL PROTECTED]> wrote: > I have noticed that in the language shootout at > shootout.alioth.debian.org the Python program for the n-body > problem is about 50% slower than the Perl program. This is an > unusual big difference. I tried to make the Python program > faster

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Matteo
Peter Maas wrote: > I have noticed that in the language shootout at shootout.alioth.debian.org > the Python program for the n-body problem is about 50% slower than the Perl > program. This is an unusual big difference. I tried to make the Python program > faster but without success. Has anybody an

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread skip
Skip> I took the original version, tweaked it slightly (probably did Skip> about the same things as Python #2, I didn't look). For N == Skip> 200,000 the time went from 21.94s (user+sys) to 17.22s. Using Skip> psyco and binding just the advance function on my improved version

Re: News on versions modules for Python-2.5?

2006-10-06 Thread John J. Lee
"Méta-MCI" <[EMAIL PROTECTED]> writes: [...] > And who can confirm that these modules are independent of Python version? > > ReportLab [...] Most of the code is pure Python and I don't recall any 2.5-specific bug reports yet. For the (optional) parts that are written in C, there are 2.5 Wind

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Paul McGuire
"Peter Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have noticed that in the language shootout at shootout.alioth.debian.org > the Python program for the n-body problem is about 50% slower than the > Perl > program. This is an unusual big difference. I tried to make the Py

Re: News on versions modules for Python-2.5?

2006-10-06 Thread [EMAIL PROTECTED]
Méta-MCI wrote: > And who can confirm that these modules are independent of Python version? > > ReportLab I can't confirm it's 100% independent, but I have been using reportlab on Windows and Linux with Python 2.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating over marshal

2006-10-06 Thread Tim Lesher
On Oct 6, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Lesher wrote: > > I'm using the marshal library to unmarshal a file containing one or > > more objects. The canonical way seems to be: > > > objs = [] > > while 1: > > try: > > objs.append(marshal.load(fobj)) > > exc

shortest mean path length

2006-10-06 Thread diffuser78
Is there any function in networkx which can compute the shortest mean path length. (Shortest length between all pairs of the nodes in the graph). Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread bearophileHUGS
[EMAIL PROTECTED] wrote: > Ah, wait a moment. One more tweak. Make the body class a psyco class. > That improves the runtime to 3.02s. Diff appended. Nice. Maybe you can do the same trick with: from psyco.classes import __metaclass__ If you want you can try that trick with this version of mine

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Peter Maas
John J. Lee wrote: > Replacing ** with multiplication in advance() cut it down to 0.78 > times the original running time for me. That brings it along side > PHP, one place below Perl (I didn't bother to upload the edited script). I tried this also but got only 90%. Strange. -- Regards/Gruesse,

Re: CGI Tutorial

2006-10-06 Thread Clodoaldo Pinto Neto
[EMAIL PROTECTED] wrote: > Clodoaldo Pinto Neto wrote: > > > print 'The submited name was "' + name + '"' > > Bzzt! Script injection security hole. See cgi.escape and use it (or a > similar function) for *all* text -> HTML output. > > > open('files/' + fileitem.filename, 'w') > > BZZT. filesyst

Re: humble coin head or tail game script I wrote

2006-10-06 Thread [EMAIL PROTECTED]
Camellia wrote: > Well...It' doesn't, have you run it yet? Yes it does, and running it reflects that behavior. > ini_guess = random.randrange(1) > list_guess = ['t', 'h'] > ini_guess = list_guess[ini_guess] random.randrange(1) will always return 0, so this will always initialize ini_guess to 't'

Re: n-body problem at shootout.alioth.debian.org

2006-10-06 Thread Peter Maas
Matteo wrote: > Of course, numpy is not a standard package (though there is a proposal > to add a standard 'array' package to python, based of numpy/numeric), > but if you want to do any numerics with python, you shouldn't be > without it. I know that nbody.py could be speeded up by psyco and nump

Re: Dumping the state of a deadlocked process

2006-10-06 Thread MrJean1
Did you try using the signal module? If not, a basic example is here which may need to be extended. /Jean Brouwers [EMAIL PROTECTED] wrote: > Hi all > > I'm currently having some issues with a process getting deadlocked. The > problem is that the only w

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
sam wrote: > hi all, > > i'm starting to put together a program to simulate the performance of > an investment portfolio in a monte carlo manner doing x thousand > iterations and extracting data from the results. > > i'm still in the early stages, and am trying to code something simple > and inte

dictionary containing a list

2006-10-06 Thread Ben
Hello... I have set up a dictionary into whose values I am putting a list. I loop around and around filling my list each time with new values, then dumping this list into the dictionary. Or so I thought... It would appear that what I am dumping into the dictionary value is only a pointer to the o

kdb and python

2006-10-06 Thread Doni Ocena
Does anyone know where to find more material on kdb and python integration? I've only found this so far -> http://kx.com/a/k/connect/python/pyk-0.9/ Also, someone once mentioned python tunnelling in kdb but I couldn't find any reading material on it. -Doni -it never ends, ... , + it never ends

Re: Python to use a non open source bug tracker?

2006-10-06 Thread Terry Reedy
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > Are bug-tracker configuration issues so critical that having to wait > 48-72hrs > to have them fixed is absolutely unacceptable for Python development? It > looks > like an overexaggeration.

Re: dictionary containing a list

2006-10-06 Thread John Machin
Ben wrote: > Hello... > > I have set up a dictionary into whose values I am putting a list. I > loop around and around filling my list each time with new values, then > dumping this list into the dictionary. Or so I thought... > > It would appear that what I am dumping into the dictionary value is

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
James Stroud wrote: > sam wrote: > >> hi all, >> >> i'm starting to put together a program to simulate the performance of >> an investment portfolio in a monte carlo manner doing x thousand >> iterations and extracting data from the results. >> >> i'm still in the early stages, and am trying to co

Re: Python to use a non open source bug tracker?

2006-10-06 Thread Paul Boddie
Terry Reedy wrote: > > When SF is down, people sometimes send tracker items to > the pydev list instead, when means someone else (who?) has to put in the > tracker or it gets lost. According to Harald Armin Massa's PostgreSQL talk at EuroPython, the PostgreSQL people manage all their bugs via mail

Re: News on versions modules for Python-2.5?

2006-10-06 Thread casevh
> And who can confirm that these modules are independent of Python version? > Gmpy I've compiled gmpy for Python 2.5. It is available at http://home.comcast.net/~casevh/ > (tip: I am on windows, and I don't can/know compile any module) casevh -- http://mail.python.org/mailman/listinfo/pyth

How to execute a python script in .NET application

2006-10-06 Thread Chandra
Hi, Is there a way to execute a python script(file) in ASP.NET application (programmatically)?? Regards, Chandra -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-06 Thread Ilias Lazaridis
Michael Ströder wrote: > Ilias Lazaridis wrote: > > > > You need just 2 active contributors - and the python community, not > > more > > Hmm, this number does not say much. It really depends on the required > service level and how much time these two people can spend for > maintaining the tracker

Names changed to protect the guilty

2006-10-06 Thread Aahz
The following line of lightly munged code was found in a publicly available Python library... if schema.elements.has_key(key) is False: Sorry, just had to vent. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "If you don't know what your program is supposed to

Re: ctypes, arrays and pointers

2006-10-06 Thread Richard Jones
Thomas Heller wrote: > Richard Jones schrieb: >> row = image_data + width * components * y >> >> but you can't add an int to a c_char_Array_2415600. > > This feature request has now come up the second time, so I guess I will > have to find a solution for it. Someone suggested a byref_at(obj,

Re: dictionary containing a list

2006-10-06 Thread Ben Finney
"Ben" <[EMAIL PROTECTED]> writes: > I have set up a dictionary into whose values I am putting a list. I > loop around and around filling my list each time with new values, > then dumping this list into the dictionary. Or so I thought... Our crystal balls are notoriously unreliable for viewing pro

Re: ctypes and setjmp

2006-10-06 Thread Richard Jones
Thomas Heller wrote: > Richard Jones schrieb: >> Currently ctypes can't play well with any C code that requires use of >> setjmp as part of its API. >> >> libpng is one of those libraries. >> >> Can anyone think of a reasonable solution to this? Perhaps ctypes might >> be patched to offer setjmp

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
you're right, of course. it occurred to me that, even if it were manageable for a few items, it would quickly become absurd as the number of items grew. this: def get_pct(): while True: pct_list=[['cash', 0], ['bond', 0], ['blue', 0], ['tech', 0], ['dev', 0]]

Re: Can't get around "IndexError: list index out of range"

2006-10-06 Thread erikcw
I ended up using len(sys.argv) > 1 for this particular problem. But I think slicing is closer to the tool I was looking for. I found a.has_key(k) or "k in a" for dictionaries - but haven't found anything similar for lists. Does it exist? I guess my example from php would technically be a dictio

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread sam
this does what i want, though i don't like the inner while loop having to be there def get_pct(): while True: pct_list=[['cash', 0], ['bond', 0], ['blue', 0], ['tech', 0], ['dev', 0]] total=0 for i in range(len(pct_list)):

Re: How to execute a python script in .NET application

2006-10-06 Thread hg
Chandra wrote: > Hi, > > Is there a way to execute a python script(file) in ASP.NET application > (programmatically)?? > > Regards, > Chandra > pythondotnet@python.org ? -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   >