Re: 4 hundred quadrillonth?

2009-05-24 Thread Lawrence D'Oliveiro
In message , Christian Heimes wrote: > Welcome to IEEE 754 floating point land! :) It used to be worse in the days before IEEE 754 became widespread. Anybody remember a certain Prof William Kahan from Berkeley, and the foreword he wrote to the Apple Numerics Manual, 2nd Edition, published in 1

Re: Problems with sys.stout.flush()

2009-05-24 Thread Hendrik van Rooyen
"Joel Ross" To: Sent: Sunday, May 24, 2009 4:32 AM Subject: Re: Problems with sys.stout.flush() > Mel wrote: > > Joel Ross wrote: > >> Rhodri James wrote: > > [ ... ] > >>> Except that you still have the interesting issue that your environment > >>> isn't responding to '\r' correctly, which wor

Re: Optimizing math functions

2009-05-24 Thread Charlie
Steven D'Aprano REMOVE-THIS-cybersource.com.au> writes: > > On Sat, 23 May 2009 09:22:59 -0400, Esmail wrote: > > > Hello all, > > > > I would like to maximize or minimize a given math function over a > > specific set of values, in Python preferably. > ... > > What it apparently can't do is fo

How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-24 Thread Igor Katson
I have written a socket server and some arbitrary clients. When I shutdown the server, and do socket.close(), I cannot immediately start it again cause it has some open sockets in TIME_WAIT state. It throws address already in use exception at me. I have searched for that in google but haven't f

Re: monitoring friendly applications

2009-05-24 Thread Imbaud Pierre
Thanks a lot. Your suggestions lead me to pypi, (I knew it but didnt remember the exact spelling, and no obvious link from www.python.org), and from there to supervisord, that answers pretty well my problem. Thanks again. Tim Roberts wrote: Imbaud Pierre wrote: I have A LOT of batch applicat

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

2009-05-24 Thread garabik-news-2005-05
Barak, Ron wrote: > > > > I thought maybe someone has a way to unzip just the end portion of the > archive (instead of the whole archive), as only the last part is needed > for reading the last line. dictzip (python implementation part of my serpento package) you have to compress the file with

Re: Problems with sys.stout.flush()

2009-05-24 Thread Joel Ross
AK wrote: import time, sys print "ONE", sys.stdout.flush() time.sleep(0.5) print "\rTWO", sys.stdout.flush() time.sleep(0.5) Running the command above prints out ONE TWO but running for i in range(10): print "ONE", time.sleep(0.2) prints out ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-24 Thread Igor Katson
Igor Katson wrote: I have written a socket server and some arbitrary clients. When I shutdown the server, and do socket.close(), I cannot immediately start it again cause it has some open sockets in TIME_WAIT state. It throws address already in use exception at me. I have searched for that in

help! Troubled when embed python into C++

2009-05-24 Thread 孟炜
I have the following codes in C++: #include void main(){ Py_Initialize(); PyRun_SimpleString("execfile(r'1.py')"); Py_Finalize(); return; } the following is in 1.py : import Tkinter root=Tkinter.Tk() root2=Tkinter.Tk() root.mainloop() root2.mainloop() this is the output after I ru

Re: 4 hundred quadrillonth?

2009-05-24 Thread Lawrence D'Oliveiro
In message <7b986ef0-d118-4e0c- afef-3c6385a4c...@b7g2000pre.googlegroups.com>, rustom wrote: > For a mathematician there are no inexact numbers; for a physicist no > exact ones. On the contrary, mathematics have worked out a precise theory of inexactness. As for exactitude in physics, Gregory

How does Python's OOP feel?

2009-05-24 Thread Ikon
I'm rather new to Python. I have PHP for my main language and I do some Java. They all have a very strict OO schema. As I red through Python's tutorial it seams it has nothing of those rules. No statical, abstract classes, functions, or variables. I wish someone, who has experience in both Java/PH

Multiprocessing and file I/O

2009-05-24 Thread Infinity77
Hi All, I am trying to speed up some code which reads a bunch of data from a disk file. Just for the fun of it, I thought to try and use parallel I/O to split the reading of the file between multiple processes. Although I have been warned that concurrent access by multiple processes to the sam

Set a variable as in setter

2009-05-24 Thread Kless
Is there any way to simplify the next code? Because I'm setting a variable by default of the same way than it's set in the setter. --- class Foo(object): def __init__(self, bar): self._bar = self._change(bar) # !!! as setter @property def bar(self): return se

Re: Multiprocessing and file I/O

2009-05-24 Thread Igor Katson
Infinity77 wrote: Hi All, I am trying to speed up some code which reads a bunch of data from a disk file. Just for the fun of it, I thought to try and use parallel I/O to split the reading of the file between multiple processes. Although I have been warned that concurrent access by multiple

Re: Replacing module with a stub for unit testing

2009-05-24 Thread A. Cavallo
how about the old and simple: import ExpensiveModuleStub as ExpensiveModule On a different league you could make use of decorator and creating caching objects but that depends entirely on the requirements (how strict your test must be, test data sizes involved and more, much more details). Rega

Re: Set a variable as in setter

2009-05-24 Thread Duncan Booth
Kless wrote: > Is there any way to simplify the next code? Because I'm setting a > variable by default of the same way than it's set in the setter. > > --- > class Foo(object): >def __init__(self, bar): > self._bar = self._change(bar) # !!! as setter What's wrong with

Re: Optimizing math functions

2009-05-24 Thread Esmail
Charlie wrote: You might also look at: http://pyparasol.sourceforge.net/example_1.html Thanks for this lead, I had never heard of parasol before. Do you know if this also works under Linux? The docs mention only the Windows platform, but given that this is Python perhaps it is save to assume t

Re: Optimizing math functions

2009-05-24 Thread Esmail
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 questions: 1. Will is also allow me to

how to get rid of pyc files ?

2009-05-24 Thread Stef Mientki
hello, Moving my entire program section between windows and Ubuntu, sometimes causes problems, due to the existence of pyc-files (and probably because my program still has hard coded paths). Now I want get rid of the pyc-files, so I wrote a py-script to remoce all pyc-files, but because it's run

Re: Set a variable as in setter

2009-05-24 Thread Mike Kazantsev
On Sun, 24 May 2009 05:06:13 -0700 (PDT) Kless wrote: > Is there any way to simplify the next code? Because I'm setting a > variable by default of the same way than it's set in the setter. > > --- > class Foo(object): >def __init__(self, bar): > self._bar = self._change

Re: how to get rid of pyc files ?

2009-05-24 Thread Mike Kazantsev
On Sun, 24 May 2009 15:01:51 +0200 Stef Mientki wrote: > Moving my entire program section between windows and Ubuntu, > sometimes causes problems, due to the existence of pyc-files > (and probably because my program still has hard coded paths). > > Now I want get rid of the pyc-files, > so I wro

Re: how to get rid of pyc files ?

2009-05-24 Thread Esmail
Stef Mientki wrote: btw, What commandline switches are available for python ? (googling didn't give me any relevant hits ) Hi Stef, This is what I get w/ v2.6 under Ubuntu 9.04 9:12 esm...@t61 ~/Python [510] python -h usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Option

Re: Set a variable as in setter

2009-05-24 Thread Mike Kazantsev
On Sun, 24 May 2009 19:03:26 +0600 Mike Kazantsev wrote: > On Sun, 24 May 2009 05:06:13 -0700 (PDT) > Kless wrote: > > > Is there any way to simplify the next code? Because I'm setting a > > variable by default of the same way than it's set in the setter. > > > > --- > > class

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-24 Thread Roy Smith
In article , Lawrence D'Oliveiro wrote: > In message , Igor Katson > wrote: > > > I have written a socket server and some arbitrary clients. When I > > shutdown the server, and do socket.close(), I cannot immediately start > > it again cause it has some open sockets in TIME_WAIT state. It thro

Re: Replacing module with a stub for unit testing

2009-05-24 Thread Steven D'Aprano
On Sun, 24 May 2009 13:14:30 +0100, A. Cavallo wrote: > how about the old and simple: > > import ExpensiveModuleStub as ExpensiveModule No, that won't do, because for it to have the desired effort, it needs to be inside the IntermediateModule, not the Test_Module. That means that IntermediateM

Re: Optimizing math functions

2009-05-24 Thread John Machin
On May 24, 10:42 pm, 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 deep

Re: how to get rid of pyc files ?

2009-05-24 Thread John Machin
On May 24, 11:01 pm, Stef Mientki wrote: > hello, > > Moving my entire program section between windows and Ubuntu, > sometimes causes problems, due to the existence of pyc-files What problems? Like avoiding having to recompile your .py files makes your app run too fast? > (and probably because m

Re: Optimizing math functions

2009-05-24 Thread Esmail
John Machin wrote: 1. Will is also allow me to maximize a function (I only saw minimum)? To maximise f(x,y), minimise -f(x,y) Ooops .. yes of course! Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing and file I/O

2009-05-24 Thread Infinity77
Hi Igor, On May 24, 1:10 pm, Igor Katson wrote: > Infinity77 wrote: > > Hi All, > > >     I am trying to speed up some code which reads a bunch of data from > > a disk file. Just for the fun of it, I thought to try and use parallel > > I/O to split the reading of the file between multiple process

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-24 Thread Igor Katson
Roy Smith wrote: In article , Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: I have written a socket server and some arbitrary clients. When I shutdown the server, and do socket.close(), I cannot immediately start it again cause it has some open sockets in TIME_WAIT sta

RE: wxpython and zoom/pan image

2009-05-24 Thread Barak, Ron
Hi Ross, You probably would get more focused answers if you addressed the question to the wxPython list at wxpython-us...@lists.wxwidgets.org As for your question, seeing your (simplified) code might help: out of hand, what you want to do is catch the events you're interested in (e.g., double-l

Re: How does Python's OOP feel?

2009-05-24 Thread Scott David Daniels
Ikon wrote: I'm rather new to Python. I have PHP for my main language and I do some Java. They all have a very strict OO schema. As I red through Python's tutorial it seams it has nothing of those rules. No statical, abstract classes, functions, or variables. I wish someone, who has experience i

Re: Extending C++ class in python

2009-05-24 Thread Diez B. Roggisch
nazia schrieb: Hi all, I'm a newbie in Python and need help. Can anyone help me by explaining the steps of extending a C++ class in Python with a simple example? I'm not interested to use SWIG like tools. Thanks for your time. If your are not interested in using the tools provided for this task

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

2009-05-24 Thread Barak, Ron
> -Original Message- > From: garabik-news-2005...@kassiopeia.juls.savba.sk > [mailto:garabik-news-2005...@kassiopeia.juls.savba.sk] > Sent: Sunday, May 24, 2009 13:37 > To: python-list@python.org > Subject: Re: A fast way to read last line of gzip archive ? > > Barak, Ron wrote: > >

Re: Multiprocessing and file I/O

2009-05-24 Thread Paul Boddie
On 24 Mai, 16:13, Infinity77 wrote: > > No, the processing of the data is fast enough, as it is very simple. > What I was asking is if anyone could share an example of using > multiprocessing to read a file, along the lines I described above. Take a look at this section in an article about multi-

Re: Set a variable as in setter

2009-05-24 Thread Kless
On 24 mayo, 12:27, Duncan Booth wrote: > Kless wrote: > > Is there any way to simplify the next code? Because I'm setting a > > variable by default of the same way than it's set in the setter. > > > --- > > class Foo(object): > >    def __init__(self, bar): > >       self._bar = s

Re: wxpython and zoom/pan image

2009-05-24 Thread edexter
On May 24, 8:57 am, "Barak, Ron" wrote: >  Hi Ross, > You probably would get more focused answers if you addressed the question to > the wxPython list at wxpython-us...@lists.wxwidgets.org > As for your question, seeing your (simplified) code might help: out of hand, > what you want to do is cat

[ANN] pyTenjin 0.7.0 - the fastest and full-featured template engine

2009-05-24 Thread kwatch
Hi, I have released pyTenjin 0.7.0 http://www.kuwata-lab.com/tenjin/ pyTenjin is the fastest template engine for Python. It is not only very fast but also full-featured and easy-to-use. You can embed Python statements and expressions into your text file. Tenjin converts it into Python program and

Re: Python -> R?

2009-05-24 Thread edexter
On May 23, 8:20 am, Esmail wrote: > Hello! > > Anyone using Python scripts and accessing some of R's functionality? > If so, what are you using? I have read about RPy, is that a good > solution? Are there others that can be recommended or are preferred? > > I would prefer to code in Python instead

Re: Background subprocess help?

2009-05-24 Thread Piet van Oostrum
> danshumaker (d) wrote: >d> Hi, >d> I'm trying to do something as simple as this: >d> "sleep 10; mail -s "test" dans < communicate_with_process &" >d> which executes immediately because it is backgrounded with "&". >d> or more generically in english: >d> "do some long process in the back

Re: wxPython gurus, please help

2009-05-24 Thread Piet van Oostrum
> Jive Dadson (JD) wrote: >JD>I have an application that opens an image file of the user's choice. I >JD> have an exception handler for the case that the user selected a bad or >JD> unsupported image file. My code is catching the exception, but >JD> unfortunately for me, after I exit the

Re: wxPython gurus, please help

2009-05-24 Thread Stef Mientki
Piet van Oostrum wrote: Jive Dadson (JD) wrote: JD>I have an application that opens an image file of the user's choice. I JD> have an exception handler for the case that the user selected a bad or JD> unsupported image file. My code is catching the exception, but JD> unfo

Re: how to get rid of pyc files ?

2009-05-24 Thread pythoncurious
On May 24, 3:58 pm, John Machin wrote: > > What problems? Like avoiding having to recompile your .py files makes > your app run too fast? > There are real problems with this. I'm having similar problems when switching between Solaris and Windows. The code is in clearcase, which uses some sort of

command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Daniel
If I try to invoke python via the command prompt I get an error "command prompt: the ntvdm cpu has encountered an illegal instruction..." I don't get this problem if I first cd to the python directory. I am running python 3.0 on windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Gerhard Häring
Daniel wrote: > If I try to invoke python via the command prompt I get an error > "command prompt: the ntvdm cpu has encountered an illegal > instruction..." > > I don't get this problem if I first cd to the python directory. I am > running python 3.0 on windows. Running Python from the Cygwin s

Re: command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Daniel
On 24 May, 18:32, Gerhard Häring wrote: > > Running Python from the Cygwin shell? Try from outside Cygwin, then. > No I am running from the windows command prompt. -- http://mail.python.org/mailman/listinfo/python-list

Can I get a technical explanation on the following error

2009-05-24 Thread grocery_stocker
How come something like '\' causes an error? Here is what I mean. [cdal...@localhost ~]$ python Python 2.6.2 (r262:71600, May 3 2009, 17:04:44) [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "test \" File "", l

Re: Set a variable as in setter

2009-05-24 Thread Kless
On 24 mayo, 15:33, Kless wrote: > On 24 mayo, 12:27, Duncan Booth wrote: > > > Kless wrote: > > > Is there any way to simplify the next code? Because I'm setting a > > > variable by default of the same way than it's set in the setter. > > > > --- > > > class Foo(object): > > >  

I need help building a data structure for a state diagram

2009-05-24 Thread Matthew Wilson
I'm working on a really simple workflow for my bug tracker. I want filed bugs to start in an UNSTARTED status. From there, they can go to STARTED. >From STARTED, bugs can go to FINISHED or ABANDONED. I know I can easily hard-code this stuff into some if-clauses, but I expect to need to add a lo

Re: Can I get a technical explanation on the following error

2009-05-24 Thread DasIch
'\' starts a escape sequence. You need to escape '\' with a '\' to make it work. >>> print 'test \\' test \ -- http://mail.python.org/mailman/listinfo/python-list

writing on file not until the end

2009-05-24 Thread Alexzive
Hello, I am a newby with python. I wrote the following code to extract a text from a file and write it to another file: linestring = open(path, 'r').read() #read all the inp file in linestring i=linestring.index("*NODE") i=linestring.index("E",i) e=linestring.index("*",i+10) textN = linestring[i+

Re: Can I get a technical explanation on the following error

2009-05-24 Thread Hans Müller
Try this: print "\\" \ is the escape character, it masks the meaning of the next chararcter. If you write print "\" python tries to print " (the meaning of " as the string delimiter is beeing masked) and finds no closing " This is why you got the error. hth. Greetings Hans -- http://mail.pyth

Re: Problems with StaticBitmaps and events

2009-05-24 Thread Water Bottle
Okay, I found the root of the weird box problem on the top left corner. It has something to do with my panels. I changed the code so that I directly used the StaticBitmap and TextCtrl inside the Frame class and the weird box was gone. I'm not sure what I'm doing wrong with the Panels. Can anyone he

Re: I need help building a data structure for a state diagram

2009-05-24 Thread Tim Chase
I'm working on a really simple workflow for my bug tracker. I want filed bugs to start in an UNSTARTED status. From there, they can go to STARTED. From STARTED, bugs can go to FINISHED or ABANDONED. I know I can easily hard-code this stuff into some if-clauses, but I expect to need to add a

Re: Problems with StaticBitmaps and events

2009-05-24 Thread Water Bottle
Hm, so it seems that it was just a sizing issue with my wx.Panels. I defined my own size, and that fixed the weird box problem. Although, now that I'm defining the size, that may not be good for when I expand the window. Everything will be stretched. Anyone know a way around that? Still having tro

Re: I need help building a data structure for a state diagram

2009-05-24 Thread Kay Schluehr
On 24 Mai, 20:16, Matthew Wilson wrote: > I'm working on a really simple workflow for my bug tracker.  I want > filed bugs to start in an UNSTARTED status.  From there, they can go to > STARTED. > > From STARTED, bugs can go to FINISHED or ABANDONED. > > I know I can easily hard-code this stuff in

Re: Can I get a technical explanation on the following error

2009-05-24 Thread grocery_stocker
On May 24, 11:47 am, Hans Müller wrote: > Try this: > > print "\\" > > \ is the escape character, it masks the meaning of the next chararcter. > > If you write print "\" python tries to print " (the meaning of " as > the string delimiter is beeing masked) and finds no closing " > This is why you g

Re: writing on file not until the end

2009-05-24 Thread Benjamin Kaplan
On Sun, May 24, 2009 at 2:46 PM, Alexzive wrote: > Hello, > I am a newby with python. I wrote the following code to extract a text > from a file and write it to another file: > > linestring = open(path, 'r').read() #read all the inp file in > linestring > > i=linestring.index("*NODE") > i=linestr

Re: LaTeXing python programs

2009-05-24 Thread Sebastian Wiesner
> On May 20, 10:10 pm, John Reid wrote: >> Alan G Isaac wrote: >> > The listings package is great and highly configurable. >> > Note that you can also input entire files of Python code >> > or pieces of them based on markers. Really quite great. >> >> I tried listings. I believe pygments makes

Re: Can I get a technical explanation on the following error

2009-05-24 Thread Rhodri James
On Sun, 24 May 2009 21:14:44 +0100, grocery_stocker wrote: On May 24, 11:47 am, Hans Müller wrote: Try this: print "\\" \ is the escape character, it masks the meaning of the next chararcter. If you write print "\" python tries to print " (the meaning of " as the string delimiter is beei

Re: writing on file not until the end

2009-05-24 Thread Rhodri James
On Sun, 24 May 2009 19:46:01 +0100, Alexzive wrote: Hello, I am a newby with python. I wrote the following code to extract a text from a file and write it to another file: linestring = open(path, 'r').read() #read all the inp file in linestring i=linestring.index("*NODE") i=linestring.index

Re: How does Python's OOP feel?

2009-05-24 Thread Dutch Masters
On May 24, 5:54 am, Ikon wrote: Be prepared for a slight wave of depression as you remember all the pointless interfaces, abstract classes, and getters/setters you created. I keep reminding myself that Java pays the bills. Having said that, the dynamic nature of Python lets you experiment with so

Re: Re: how to get rid of pyc files ?

2009-05-24 Thread Dave Angel
pythoncuri...@gmail.com wrote: On May 24, 3:58 pm, John Machin wrote: What problems? Like avoiding having to recompile your .py files makes your app run too fast? There are real problems with this. I'm having similar problems when switching between Solaris and Windows. The code is in

Re: how to get rid of pyc files ?

2009-05-24 Thread John Machin
On May 25, 3:09 am, pythoncuri...@gmail.com wrote: > On May 24, 3:58 pm, John Machin wrote: > > > > > What problems? Like avoiding having to recompile your .py files makes > > your app run too fast? > > There are real problems with this. I'm having similar problems when > switching > between Solar

Re: Need Help

2009-05-24 Thread Piet van Oostrum
> abosalim (a) a écrit: >a> #Gui >a> import re, collections >a> from Tkinter import * >a> from nltk_lite import tokenize >a> def words(text): return re.findall('[a-z]+', text.lower()) >a> def train(features): >a> model = collections.defaultdict(lambda: 1) >a> for f in features: >a>

Compile python extensions under windows/cygwin

2009-05-24 Thread Joana
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. Can anyone help me? Thanks in advance Joana -- http://m

Re: wxPython gurus, please help

2009-05-24 Thread Paul Probert
Jive Dadson wrote: >I have an application that opens an image file of the user's choice. > I have an exception handler for the case that the user selected a bad > or unsupported image file. My code is catching the exception, but > unfortunately for me, after I exit the except-clause, wxPytho

Re: how to get rid of pyc files ?

2009-05-24 Thread JKPeck
On May 24, 4:08 pm, Dave Angel wrote: > pythoncuri...@gmail.com wrote: > > On May 24, 3:58 pm, John Machin wrote: > > >> What problems? Like avoiding having to recompile your .py files makes > >> your app run too fast? > > > There are real problems with this. I'm having similar problems when > >

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

2009-05-24 Thread David Bolen
"Barak, Ron" writes: > I thought maybe someone has a way to unzip just the end portion of > the archive (instead of the whole archive), as only the last part is > needed for reading the last line. The problem is that gzip compressed output has no reliable intermediate break points that you can j

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread Christian Heimes
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. Are you sure you want to use Cygwin?

Searching for pyvm

2009-05-24 Thread Vladimir G. Ivanovic
Hello, I'm looking for the sources to pyvm, a python virtual machine implementation which can run Python 2.4 bytecode. If someone could point me in the right direction, I would appreciate it. Thanks. --- Vladimir P.S. The link on the author's pyvm page is broken, and I have been unable to find

Re: how to get rid of pyc files ?

2009-05-24 Thread David Lyon
On Sun, 24 May 2009 15:01:51 +0200, Stef Mientki wrote: > hello, > > Moving my entire program section between windows and Ubuntu, > sometimes causes problems, due to the existence of pyc-files > (and probably because my program still has hard coded paths). > > Is there a way to prevent generatin

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread Joana
On 25 Maio, 00:13, Christian Heimes wrote: > 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 Win

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread David Lyon
On Sun, 24 May 2009 15:34:42 -0700 (PDT), 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 direct

Re: writing on file not until the end

2009-05-24 Thread Dave Angel
Alexzive wrote: Hello, I am a newby with python. I wrote the following code to extract a text from a file and write it to another file: linestring = open(path, 'r').read() #read all the inp file in linestring i=linestring.index("*NODE") i=linestring.index("E",i) e=linestring.index("*",i+10) tex

Re: I need help building a data structure for a state diagram

2009-05-24 Thread Matthew Wilson
On Sun 24 May 2009 03:42:01 PM EDT, Kay Schluehr wrote: > > General answer: you can encode finite state machines as grammars. > States as non-terminals and transition labels as terminals: > > UNSTARTED: 'start' STARTED > STARTED: 'ok' FINISHED | 'cancel' ABANDONED > ABANDONED: 'done' > FINISHED: 'd

Re: 4 hundred quadrillonth?

2009-05-24 Thread Dave Angel
Dennis Lee Bieber wrote: On Sun, 24 May 2009 22:47:51 +1200, Lawrence D'Oliveiro declaimed the following in gmane.comp.python.general: As for exactitude in physics, Gregory Chaitin among others has been trying to rework physics to get rid of real numbers altogether. By dec

How can I get access to the function called as a property?

2009-05-24 Thread Matthew Wilson
I use a @property decorator to turn some methods on a class into properties. I want to be able to access some of the attributes of the original funtion, but I don't know how to get to it. Any ideas? Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 hundred quadrillonth?

2009-05-24 Thread Erik Max Francis
Lawrence D'Oliveiro wrote: In message , Christian Heimes wrote: Welcome to IEEE 754 floating point land! :) It used to be worse in the days before IEEE 754 became widespread. Anybody remember a certain Prof William Kahan from Berkeley, and the foreword he wrote to the Apple Numerics Manual

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread Christian Heimes
Joana wrote > hmm.. but the problem with mingw32 is that it does not have the > libraries I need. The module I want to install includes netinet/in.h. > So the answer is that I can't install that module in Windows? What's the name of the package? Perhaps it doesn't work on Windows. Or it hasn't bee

Re: how to get rid of pyc files ?

2009-05-24 Thread Terry Reedy
Stef Mientki wrote: btw, What commandline switches are available for python ? The set of documents on the site and at least on Windows comes with Using Python. First chapter: Command Line -- http://mail.python.org/mailman/listinfo/python-list

About Standard Numerics (was Re: 4 hundred quadrillonth?)

2009-05-24 Thread Lawrence D'Oliveiro
In message <9mwdntfmpprjqotxnz2dnuvz_vadn...@giganews.com>, Erik Max Francis wrote: > Lawrence D'Oliveiro wrote: > >> In message , >> Christian Heimes wrote: >> >>> Welcome to IEEE 754 floating point land! :) >> >> It used to be worse in the days before IEEE 754 became widespread. >> Anybody re

Re: How can I get access to the function called as a property?

2009-05-24 Thread Benjamin Peterson
Matthew Wilson tplus1.com> writes: > > I use a @property decorator to turn some methods on a class into > properties. I want to be able to access some of the attributes of the > original funtion, but I don't know how to get to it. my_class.__dict__["some_property].(fget|fdel|fset) -- http:

Re: How can I get access to the function called as a property?

2009-05-24 Thread Christian Heimes
Matthew Wilson schrieb: > I use a @property decorator to turn some methods on a class into > properties. I want to be able to access some of the attributes of the > original funtion, but I don't know how to get to it. > > Any ideas? Here you are: >>> class Example(object): ... @property ...

Re: Need Help

2009-05-24 Thread Steven D'Aprano
On Mon, 25 May 2009 00:16:19 +0200, Piet van Oostrum wrote: > By the way, it is better to add python code as attachment instead of > inline text because some news software might fold the lines like in your > posting, making it difficult to reconstruct the code. Except that some news software migh

Re: making a python program in windows

2009-05-24 Thread Tim Roberts
rustom wrote: > >Thanks for this (and all other) tips. >Strangely now my m/c shows things exactly like so. A new .py file gets >associated with python but two days ago it was with pythonw?! No, .py files are always associated with python.exe. .pyw files are associated with pythonw.exe. -- Tim R

Re: how to get rid of pyc files ?

2009-05-24 Thread Steven D'Aprano
On Sun, 24 May 2009 15:01:51 +0200, Stef Mientki wrote: > Is there a way to prevent generating pyc-files ? Put the .py files in a read-only directory. > Or is there a way to > redirect the generated pyc-files to a dedicated location ? No. > btw, What commandline switches are available for p

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-24 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > In article , > Lawrence D'Oliveiro wrote: > >> The right thing to do is try to ensure that all your connections are >> properly closed at shutdown. That may not be enough (if your server >> crashes due to bugs), so the other thing you need to do is retry the >> s

Re: 4 hundred quadrillonth?

2009-05-24 Thread David Robinow
On Sun, May 24, 2009 at 7:51 PM, Dave Angel wrote: >>        By decreeing that the value of PI is 3? >> > > Only in Ohio. Please, we're smarter than that in Ohio. In fact, while the Indiana legislature was learning about PI, we had guys inventing the airplane. http://en.wikipedia.org/wiki/Indiana

Re: 4 hundred quadrillonth?

2009-05-24 Thread Lawrence D'Oliveiro
In message , Dennis Lee Bieber wrote: > On Sun, 24 May 2009 22:47:51 +1200, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> As for exactitude in physics, Gregory Chaitin among others has been >> trying to rework physics to get rid of real numbers altogether. >

Re: Compile python extensions under windows/cygwin

2009-05-24 Thread brendan . johnston
On May 25, 9:42 am, David Lyon wrote: > On Sun, 24 May 2009 15:34:42 -0700 (PDT), 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

Re: PureData py/pyExt into standalone python

2009-05-24 Thread edexter
On May 23, 6:49 am, responsib...@gmail.com wrote: > Hi guys, > > Short version: > > I've written some python classes for py/pyExt extensions for the > "dataflow" graphical programming environment PureData. Here's an > example PureData screenshot for clarity: > >         see:http://i40.tinypic.com/2

Re: 4 hundred quadrillonth?

2009-05-24 Thread Steven D'Aprano
On Mon, 25 May 2009 16:21:19 +1200, Lawrence D'Oliveiro wrote: > In message , Dennis > Lee Bieber wrote: > >> On Sun, 24 May 2009 22:47:51 +1200, Lawrence D'Oliveiro >> declaimed the following in >> gmane.comp.python.general: >> >>> As for exactitude in physics, Gregory Chaitin among others has

Re: I need help building a data structure for a state diagram

2009-05-24 Thread Kay Schluehr
On 25 Mai, 01:46, Matthew Wilson wrote: > On Sun 24 May 2009 03:42:01 PM EDT, Kay Schluehr wrote: > > > > > General answer: you can encode finite state machines as grammars. > > States as non-terminals and transition labels as terminals: > > > UNSTARTED: 'start' STARTED > > STARTED: 'ok' FINISHED

Re: Extending C++ class in python

2009-05-24 Thread nazia
On May 24, 9:03 pm, "Diez B. Roggisch" wrote: > nazia schrieb: > > > Hi all, > > I'm a newbie in Python and need help. Can anyone help me by explaining > > the steps ofextendingaC++classin Python with a simple example? > > I'm not interested to use SWIG like tools. > > Thanks for your time. > > If

Re: Can I get a technical explanation on the following error

2009-05-24 Thread Jim Garrison
And as an interesting exercise, try print r'test \' print r'test \\' Because of the way raw string parsing is defined, neither of these will pass the parser. In fact, a raw string cannot have a backslash as its last character. -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 hundred quadrillonth?

2009-05-24 Thread Erik Max Francis
Dennis Lee Bieber wrote: On Mon, 25 May 2009 16:21:19 +1200, Lawrence D'Oliveiro declaimed the following in gmane.comp.python.general: Interesting kind of mindset, that assumes that the opposite of "real" must be "integer" or a subset thereof... No, but since PI (and e) are both tran

wxPython ICON constants

2009-05-24 Thread Water Bottle
I've been wondering, is there a way to grab icon information just given the type of OS? So if I wanted to grab the Firefox icon, how would I do that since the user could have changed the default icon to something else? Is there a library of these constants? -- http://mail.python.org/mailman/listin

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

2009-05-24 Thread Barak, Ron
Thanks David: excellent suggestions! I couldn't really go with the shell utilities approach, as I have no say in my user environment, and thus cannot assume which binaries are install on the user's machine. I'll try and implement your last suggestion, and see if the performance is acceptable to

Re: writing on file not until the end

2009-05-24 Thread Peter Otten
Alexzive wrote: > I am a newby with python. I wrote the following code to extract a text > from a file and write it to another file: > > linestring = open(path, 'r').read() #read all the inp file in > linestring > > i=linestring.index("*NODE") > i=linestring.index("E",i) > e=linestring.index("*"

  1   2   >