Re: return image in mod python

2007-11-22 Thread Peter Otten
Abandoned wrote: Hi i have a problem. def showimage(req): from PIL import Image im=Image.open(c:\image-2.jpg) im.thumbnail((800,600), Image.ANTIALIAS) req.sendfile(im) give me some error. How can i return this image witdhout save ? image =

Re: eof

2007-11-22 Thread Hendrik van Rooyen
braver [EMAIL PROTECTED] wrote: Well folks compare scripting languages all the time, and surely Ruby is closer to Python than C++. Since Ruby can do f.eof, which is easily found in its references, and Python can't, or its EOF can't easily be found -- the one *equivalent* to a semantically

Re: the annoying, verbose self

2007-11-22 Thread A.T.Hofkamp
On 2007-11-22, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 21 Nov 2007 15:51:56 -0800, braver wrote: Is there any trick to get rid of having to type the annoying, character-eating self. prefix everywhere in a class? You got this highly flexible language, very good for rapid programming,

Re: why it is invalid syntax?

2007-11-22 Thread Stef Mientki
alf wrote: Hi, I wonder why it is an invalid syntax: if 1: if 1: if 1: print 1 File stdin, line 1 if 1: if 1: if 1: print 1 or if 1: for i in range(10): print i File stdin, line 1 if 1: for i in range(10): print i I would expect one could nest :

Re: logging and propagation

2007-11-22 Thread oj
On Nov 22, 5:44 am, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 21, 11:38 am, oj [EMAIL PROTECTED] wrote: Hi, I want to setuploggingwith two loggers: The child logger is used when something different needs to be done with the log record, and the log record will propagate and be

Re: eof

2007-11-22 Thread braver
On Nov 22, 10:37 am, Wayne Brehaut [EMAIL PROTECTED] wrote: As others have already pointed out, because it's seldom necessary in Python. You know what? I've read this many times, and it's a lot of self- congratulation. There's lot of things which can be useful in Python. This lack of EOF is

Re: Next float?

2007-11-22 Thread Fredrik Johansson
On Nov 22, 2007 4:04 AM, Steven D'Aprano [EMAIL PROTECTED] wrote: Is there a simple, elegant way in Python to get the next float from a given one? By next float, I mean given a float x, I want the smallest float larger than x. Bonus points if I can go in either direction (i.e. the previous

RE: Please help in creating Python function in C ++ program

2007-11-22 Thread Borse, Ganesh
Hi, Yes I agree. After compile() this is *definition* of that function. I would like to know, how can we use this code object call it as a function? May be - how do we convert this Code Object to Function Object to work as Callable Object? Thanks Regards Ganesh -Original Message- From:

Re: python safe scripting

2007-11-22 Thread Vladimir Rusinov
On 11/21/07, Guilherme Polo [EMAIL PROTECTED] wrote: 2007/11/21, Vladimir Rusinov [EMAIL PROTECTED]: Hello! In one my project (it's logfile manager) I want to implement 'smart' configuration files, e.g. logfile(/var/log/messages) if (size() 10*1024*1024) and (lavg() 5):

scipy-0.6.0.win32-py2.5.exe does not install

2007-11-22 Thread Frank Moyles
Hi, I want to use SciPy library. I am using W2k, and ActiveState Python 2.5. I have succesfully numpy, but when I run the scipy-0.6.0.win32-py2.5.exe (from the downloads section on the SciPy page), nothing happens - i.e. no information is printed on the console, and the setup application

Re: why it is invalid syntax?

2007-11-22 Thread Guilherme Polo
2007/11/22, Stef Mientki [EMAIL PROTECTED]: alf wrote: Hi, I wonder why it is an invalid syntax: if 1: if 1: if 1: print 1 File stdin, line 1 if 1: if 1: if 1: print 1 or if 1: for i in range(10): print i File stdin, line 1 if 1: for i in range(10):

Re: the annoying, verbose self

2007-11-22 Thread bearophileHUGS
Alexy: Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better- looking than self. Ruby speed will increase, don't worry, as more people will use it. Bye, bearophile --

Zipf test in Python

2007-11-22 Thread Albert-jan Roskam
Hi, I have hospital data for 5 groups of hospitals. Each group of hospitals used a different tool to register medical procedures. Since the medical procedures are probably Zipf distributed, I want to formally test whether the hospitals differ in terms of procedure-ditribution. Is there a Python

Research-oriented Python mailing list?

2007-11-22 Thread Albert-jan Roskam
Hi again, One more Q: I was wondering if there exists a more research-oriented Python listserv. This one is good (or so it seems, I'm just a newbie!), but the topics are very broad. Suggestions, anyone? Thanks in advance! Cheers!!! Albert-Jan Cheers! Albert-Jan

Re: Formatting question.

2007-11-22 Thread M.-A. Lemburg
Dennis Lee Bieber wrote: On Wed, 21 Nov 2007 08:36:28 -0800 (PST), mike5160 [EMAIL PROTECTED] declaimed the following in comp.lang.python: Thanks to you for your reply. I am a newbie to Python and appreciate you helping me. Now, I am importing data from an excel sheet and getting it ready

Re: eof

2007-11-22 Thread braver
On Nov 22, 5:08 am, I V [EMAIL PROTECTED] wrote: On Wed, 21 Nov 2007 17:06:15 -0800, braver wrote: It looks like ruby internally buffers the stream itself, which is how come it can support this. According to the docs: Note that IO#eof? reads data to a input buffer.

Re: Research-oriented Python mailing list?

2007-11-22 Thread Bruno Desthuilliers
Albert-jan Roskam a écrit : Hi again, One more Q: I was wondering if there exists a more research-oriented Python listserv. This one is good (or so it seems, I'm just a newbie!), but the topics are very broad. Suggestions, anyone? google search on comp.lang.py may be what you're looking

Re: Research-oriented Python mailing list?

2007-11-22 Thread Robin Becker
Albert-jan Roskam wrote: Hi again, One more Q: I was wondering if there exists a more research-oriented Python listserv. This one is good (or so it seems, I'm just a newbie!), but the topics are very broad. Suggestions, anyone? Thanks in advance! Cheers!!! Albert-Jan Cheers!

Problems with if/elif statement syntax

2007-11-22 Thread Neil Webster
Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of code: if a = 20 and a 100: if c == c: radius = 500 else:

Re: Problems with if/elif statement syntax

2007-11-22 Thread oj
On Nov 22, 11:09 am, Neil Webster [EMAIL PROTECTED] wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of code: if a = 20 and a 100: if c

Re: why it is invalid syntax?

2007-11-22 Thread cokofreedom
On Nov 22, 10:58 am, Guilherme Polo [EMAIL PROTECTED] wrote: 2007/11/22, Stef Mientki [EMAIL PROTECTED]: alf wrote: Hi, I wonder why it is an invalid syntax: if 1: if 1: if 1: print 1 File stdin, line 1 if 1: if 1: if 1: print 1 or if 1: for i in range(10):

Re: Problems with if/elif statement syntax

2007-11-22 Thread cokofreedom
On Nov 22, 12:16 pm, oj [EMAIL PROTECTED] wrote: On Nov 22, 11:09 am, Neil Webster [EMAIL PROTECTED] wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of

Re: import pysqlite2 or import sqlite3?

2007-11-22 Thread Mike MacDonald
On Nov 21, 3:02 pm, Hertha Steck [EMAIL PROTECTED] wrote: Hello, I'm using Python 2.5.1, Pysqlite 2.3.5 and SQLite 3.4.1 on Gentoo Linux. I've always imported pysqlite using from pysqlite2 import dbapi2 and that works. If I try import sqlite3 I get Traceback (most recent call last):

Re: Problems with if/elif statement syntax

2007-11-22 Thread [EMAIL PROTECTED]
On 22 Nov, 12:09, Neil Webster [EMAIL PROTECTED] wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of code: if a = 20 and a 100: if c ==

Python Windows installation

2007-11-22 Thread Frank Moyles
does anyone know how I can automate installation of the Windows Python distribution, using python1.5.1.msi ? I want to be able to run the installation without user interaction, and pass default parameters (instead of user entries), during the installation process. This can be done with other

Re: Problems with if/elif statement syntax

2007-11-22 Thread cokofreedom
On Nov 22, 12:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 22 Nov, 12:09, Neil Webster [EMAIL PROTECTED] wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following

Re: Python Windows installation

2007-11-22 Thread MC
Hi! 1.5.1 Sure? 1.5.1? For Python 2.5, look ActiveState. Their distrib have silent option. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Research-oriented Python mailing list?

2007-11-22 Thread Paul Boddie
On 22 Nov, 12:05, Robin Becker [EMAIL PROTECTED] wrote: Albert-jan Roskam wrote: One more Q: I was wondering if there exists a more research-oriented Python listserv. This one is good (or so it seems, I'm just a newbie!), but the topics are very broad. Suggestions, anyone? [...] I

SciPy question (installation on Windows)

2007-11-22 Thread Frank Moyles
Hi, I want to use SciPy library. I am using W2k, and the standard Python 2.5.1 binary distribution from www.pthon.org I have already succesfully installed numpy, but when I try to install SciPy (by running the binary provided at scipy.org) - scipy-0.6.0.win32-py2.5.exe I get nothing. That is

Re: eof

2007-11-22 Thread Duncan Booth
braver [EMAIL PROTECTED] wrote: In many cases, you want to do this: for line in f: do something with the line, setup counts and things if line % 1000 == 0 or f.eof(): # eof() doesn't exist in Python yet! use the setup variables and things to process the chunk My control

Creation of multiple threads

2007-11-22 Thread tarun
Hello All, I got the following example from *http://wiki.wxpython.org/LongRunningTasks*http://wiki.wxpython.org/LongRunningTasks This example shows how a worker thread can be created from the main GUI and the main GUI is notified when the worker thread has done its work.. But my requirement is:

Re: eof

2007-11-22 Thread braver
On Nov 22, 3:26 pm, Duncan Booth [EMAIL PROTECTED] wrote: This sounds like a case for writing a generator. Try this one: [...] Thanks, Duncan! Really cool useful. And yield is the Ruby way, too! (Wayne -- :P). Cheers, Alexy -- http://mail.python.org/mailman/listinfo/python-list

Re: eof

2007-11-22 Thread Boris Borcic
Duncan Booth wrote: import itertools def chunks(f, size): iterator = iter(f) def onechunk(line): yield line for line in itertools.islice(iterator, size-1): yield line for line in iterator: yield onechunk(line) Quite simpler, and provides

Re: eof

2007-11-22 Thread Boris Borcic
def chunked(chunksize,f) : from itertools import count,groupby counter=count(chunksize).next return groupby(f,lambda _ : counter()/chunksize) And more to the point, no yield for Alexy to mock :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Contextmenu in a QTreeWidget with PyQT

2007-11-22 Thread David Boddie
On Wed Nov 21 19:46:48 CET 2007, blaven wrote: I apologize in advance if this is not the correct forum to ask this and if someone knows a better place, please let me know. There is a mailing list for PyQt/PyKDE issues: http://www.riverbankcomputing.com/mailman/listinfo/pyqt It's not a

Re: the annoying, verbose self

2007-11-22 Thread Kay Schluehr
On 22 Nov., 00:51, braver [EMAIL PROTECTED] wrote: But things grow -- is there any metaprogramming tricks or whatnot we can throw on the self? http://docs.python.org/lib/compiler.html -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-22 Thread braver
On Nov 22, 4:34 pm, Kay Schluehr [EMAIL PROTECTED] wrote: On 22 Nov., 00:51, braver [EMAIL PROTECTED] wrote: But things grow -- is there any metaprogramming tricks or whatnot we can throw on the self? http://docs.python.org/lib/compiler.html Indeed. Well, my current solution is to bow to

Re: the annoying, verbose self

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 10:13:46AM +0100, A.T.Hofkamp wrote regarding Re: the annoying, verbose self: On 2007-11-22, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 21 Nov 2007 15:51:56 -0800, braver wrote: Is there any trick to get rid of having to type the annoying, character-eating

Re: why it is invalid syntax?

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 06:47:33AM +, Marc 'BlackJack' Rintsch wrote regarding Re: why it is invalid syntax?: It's quite unreadable and if this would be allowed you would have to introduce a special rule to forbid ``else``, ``except`` and ``finally`` because it can lead to ambiguities.

Re: eof

2007-11-22 Thread Duncan Booth
Boris Borcic [EMAIL PROTECTED] wrote: Duncan Booth wrote: import itertools def chunks(f, size): iterator = iter(f) def onechunk(line): yield line for line in itertools.islice(iterator, size-1): yield line for line in iterator: yield

Re: eof

2007-11-22 Thread braver
On Nov 22, 5:32 pm, Neil Cerutti [EMAIL PROTECTED] wrote: There's nothing special about Python except indentation, which gets screwed up between editors all the time. (It's much easier to flip- flop between TextMate and Emacs with Ruby than with Python, without setting your tabs and

foldr function in Python

2007-11-22 Thread Ant
Hi all, I've just been reading with interest this article: http://caos.di.uminho.pt/~ulisses/blog/2007/11/20/foldr-the-magic-function/ It's a useful function that (with a more intuitive name) could prove a compelling addition to the itertools module. In it's python form, it would be something

Re: eof

2007-11-22 Thread Boris Borcic
Duncan Booth wrote: Nice, thank you. Welcome. But why 'count(chunksize)' rather than just 'count()'? To number the first chunk 1, etc. using count() starts with 0. Matter of taste. Does it make a difference anywhere? And I'd recommend using // rather than / otherwise it breaks if you do

Re: eof

2007-11-22 Thread Diez B. Roggisch
braver schrieb: On Nov 22, 5:32 pm, Neil Cerutti [EMAIL PROTECTED] wrote: There's nothing special about Python except indentation, which gets screwed up between editors all the time. (It's much easier to flip- flop between TextMate and Emacs with Ruby than with Python, without setting your

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Aaron Watters
On Nov 22, 9:53 am, Tzury Bar Yochay [EMAIL PROTECTED] wrote: The following is a code I am using for a simple tcp echo server. When I run it and then connect to it (with Telnet for example) if I shout down the telnet the CPU tops 100% of usage and saty there forever def handle(self):

Re: eof

2007-11-22 Thread Hrvoje Niksic
Diez B. Roggisch [EMAIL PROTECTED] writes: Language comparisons are sometimes good. They are best when they are free of FUD. So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that requires buffering, something that affects speed. I don't get it, Python's files

Re: eof

2007-11-22 Thread braver
On Nov 22, 6:08 pm, J. Clifford Dyer [EMAIL PROTECTED] wrote: So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that's not how you compare languages. You compare languages by stating what you are actually trying to do, and figuring out the most natural solution

100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
The following is a code I am using for a simple tcp echo server. When I run it and then connect to it (with Telnet for example) if I shout down the telnet the CPU tops 100% of usage and saty there forever. Can one tell what am I doing wrong? #code.py import SocketServer class

Re: logging and propagation

2007-11-22 Thread Vinay Sajip
On Nov 22, 2:34 pm, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 22, 9:18 am, oj [EMAIL PROTECTED] wrote: Why not apply the same filter to the parent loggers? Of course, you can apply filters at the loggers or the handlers. The filters at the logger are checked first. If they pass, then the

Re: eof

2007-11-22 Thread Neil Cerutti
On 2007-11-22, braver [EMAIL PROTECTED] wrote: On Nov 22, 10:37 am, Wayne Brehaut [EMAIL PROTECTED] wrote: As others have already pointed out, because it's seldom necessary in Python. You know what? I've read this many times, and it's a lot of self- congratulation. There's lot of things

Re: logging and propagation

2007-11-22 Thread Vinay Sajip
On Nov 22, 9:18 am, oj [EMAIL PROTECTED] wrote: On Nov 22, 5:44 am, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 21, 11:38 am, oj [EMAIL PROTECTED] wrote: Hi, I want to setuploggingwith two loggers: The child logger is used when something different needs to be done with the log

Re: eof

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 06:53:59AM -0800, braver wrote regarding Re: eof: Language comparisons are sometimes good. They are best when they are free of FUD. So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that's not how you compare languages. You compare

Re: eof

2007-11-22 Thread braver
On Nov 22, 6:10 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Granted, they aren't part of the stdlib - but then, lots of things aren't. As Hendrik noticed, I can't even add my own f.eof() if I want to have buffering -- is that right? The tradeoff between speed and convenience is something I'd

Re: eof

2007-11-22 Thread Hrvoje Niksic
braver [EMAIL PROTECTED] writes: On Nov 22, 6:10 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Granted, they aren't part of the stdlib - but then, lots of things aren't. As Hendrik noticed, I can't even add my own f.eof() if I want to have buffering -- is that right? You can, you just need

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Hrvoje Niksic
Tzury Bar Yochay [EMAIL PROTECTED] writes: The following is a code I am using for a simple tcp echo server. When I run it and then connect to it (with Telnet for example) if I shout down the telnet the CPU tops 100% of usage and saty there forever. Can one tell what am I doing wrong? If you

Re: eof

2007-11-22 Thread braver
On Nov 22, 6:40 pm, J. Clifford Dyer [EMAIL PROTECTED] wrote: You yourself said that performance is a complaint of yours regarding Ruby, so why claim that Ruby's way is clearly better in a case where it causes a known performance hit? See Hrvoje's remark above -- we can have EOF and eat it

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
data = dummy while data: ... Thanks Alot -- http://mail.python.org/mailman/listinfo/python-list

Re: eof

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 07:17:41AM -0800, braver wrote regarding Re: eof: On Nov 22, 6:08 pm, J. Clifford Dyer [EMAIL PROTECTED] wrote: So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that's not how you compare languages. You compare languages by

Re: Research-oriented Python mailing list?

2007-11-22 Thread Michael Tobis
Perhaps what you are looking for is here: http://www.scipy.org/Mailing_Lists mt -- http://mail.python.org/mailman/listinfo/python-list

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Tzury Bar Yochay
Thank Hrvoje as well -- http://mail.python.org/mailman/listinfo/python-list

Re: extension to idle to clear screen - but how to write to screen?

2007-11-22 Thread owl
On Nov 17, 3:27 pm, Tal Einat [EMAIL PROTECTED] wrote: On Nov 15, 10:20 pm, owl [EMAIL PROTECTED] wrote: and here I thought I was going to finally be able to change the world AND contribute back to python with my amazing clear screen extension - but I can't get it to work. ;( Copying

Re: why it is invalid syntax?

2007-11-22 Thread Stargaming
On Thu, 22 Nov 2007 03:24:48 -0800, cokofreedom wrote: On Nov 22, 10:58 am, Guilherme Polo [EMAIL PROTECTED] wrote: 2007/11/22, Stef Mientki [EMAIL PROTECTED]: alf wrote: Hi, I wonder why it is an invalid syntax: if 1: if 1: if 1: print 1 File stdin, line 1 if 1:

Re: eof

2007-11-22 Thread Thomas Bellman
Hrvoje Niksic [EMAIL PROTECTED] wrote: I don't get it, Python's files are implemented on top of stdio FILE objects, which do buffering and provide EOF checking (of the sort where you can check if a previous read hit the EOF, but still). Why not export that functionality? Alexy wants to

Re: why it is invalid syntax?

2007-11-22 Thread cokofreedom
On Nov 22, 5:46 pm, Stargaming [EMAIL PROTECTED] wrote: On Thu, 22 Nov 2007 03:24:48 -0800, cokofreedom wrote: On Nov 22, 10:58 am, Guilherme Polo [EMAIL PROTECTED] wrote: 2007/11/22, Stef Mientki [EMAIL PROTECTED]: alf wrote: Hi, I wonder why it is an invalid syntax: if

Re: Python web frameworks

2007-11-22 Thread Istvan Albert
On Nov 21, 12:15 am, Graham Dumpleton [EMAIL PROTECTED] wrote: I would say that that is now debatable. Overall mod_wsgi is probably a better package in terms of what it has to offer. Only thing against mod_wsgi at this point is peoples willingness to accept something that is new in

Re: Problems with if/elif statement syntax

2007-11-22 Thread Scott David Daniels
Neil Webster wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of code: if a = 20 and a 100: if c == c: radius = 500

Re: eof

2007-11-22 Thread Neil Cerutti
On 2007-11-22, Hrvoje Niksic [EMAIL PROTECTED] wrote: Diez B. Roggisch [EMAIL PROTECTED] writes: Language comparisons are sometimes good. They are best when they are free of FUD. So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that requires buffering, something

Re: 100% CPU Usage when a tcp client is disconnected

2007-11-22 Thread Scott David Daniels
Aaron Watters wrote: On Nov 22, 9:53 am, Tzury Bar Yochay [EMAIL PROTECTED] wrote: The following is a code I am using for a simple tcp echo server. When I run it and then connect to it (with Telnet for example) if I shout down the telnet the CPU tops 100% of usage and saty there forever

error handling

2007-11-22 Thread [EMAIL PROTECTED]
i want to capture run time errors so that the execution of program doesnt stop. like i want an error handler function ( that will email me or something like that ) on error and not stop the execution of program. how do i do this? i can not use try except for this... thanks --

Re: Research-oriented Python mailing list?

2007-11-22 Thread Jaap Spies
Michael Tobis wrote: Perhaps what you are looking for is here: http://www.scipy.org/Mailing_Lists mt Or here: http://www.sagemath.org/ http://www.sagemath.org/lists.html Jaap -- http://mail.python.org/mailman/listinfo/python-list

Subprocess and 16-bit FORTRAN

2007-11-22 Thread Federico Ceccatto
Hello, For the past year I've been building an XP Python/wxPython shell of sorts for several dozen command line FORTRAN tools developed for various material science problems. Given how the methods and how-to's have been lost to everyone but the original creators for these 80's to 90's pieces of

Re: the annoying, verbose self

2007-11-22 Thread Ayaz Ahmed Khan
braver wrote: Is there any trick to get rid of having to type the annoying, character-eating self. prefix everywhere in a class? Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better- looking

Re: how terminate console(not Ctrl-C)

2007-11-22 Thread oj
On Nov 22, 3:58 am, NoName [EMAIL PROTECTED] wrote: Is it possible to interrupt loop (program) by pressing Q key like Ctrl- C? how can i hook user's keypress while program running? thnx There's a quite complicated example here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/203830

Re: foldr function in Python

2007-11-22 Thread oj
On Nov 22, 3:02 pm, Ant [EMAIL PROTECTED] wrote: Hi all, I've just been reading with interest this article:http://caos.di.uminho.pt/~ulisses/blog/2007/11/20/foldr-the-magic-fun... It's a useful function that (with a more intuitive name) could prove a compelling addition to the itertools

Re: the annoying, verbose self

2007-11-22 Thread Bruno Desthuilliers
Colin J. Williams a écrit : [EMAIL PROTECTED] wrote: Alexy: Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better- looking than self. Ruby speed will increase, don't worry, as more people

Re: Python web frameworks

2007-11-22 Thread Ian Bicking
On Nov 20, 7:55 am, Joe Riopel [EMAIL PROTECTED] wrote: On Nov 20, 2007 8:46 AM, BartlebyScrivener [EMAIL PROTECTED] wrote: Django comes with its own little server so that you don't have to set up Apache on your desktop to play with it. Pylons too, it's good for development but using the

Re: Zipf test in Python

2007-11-22 Thread Terry Reedy
When you start a new topic, you should start a *new* thread/post/message (depending on your news client) rather than responding to an existing thread. This will not be seen by anyone with a modern newsreader that collapses threads to one line who does not expand the 'invalid syntax' thread this

Re: Research-oriented Python mailing list?

2007-11-22 Thread Terry Reedy
Albert-jan Roskam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Hi again, | | One more Q: I was wondering if there exists a more | research-oriented Python listserv. This one is good | (or so it seems, I'm just a newbie!), but the topics | are very broad. Suggestions, anyone?

Re: Python Windows installation

2007-11-22 Thread Martin v. Löwis
does anyone know how I can automate installation of the Windows Python distribution, using python1.5.1.msi ? See http://www.python.org/download/releases/2.5/ then follow the link automated installation to http://www.python.org/download/releases/2.5/msi/#automated I want to be able to run

How to read gzipped utf8 file in Python?

2007-11-22 Thread John Nagle
I have a large (gigabytes) file which is encoded in UTF-8 and then compressed with gzip. I'd like to read it with the gzip module and utf8 decoding. The obvious approach is fd = gzip.open(fname, 'rb',encoding='utf8') But gzip.open doesn't support an encoding parameter. (It probably

pre-ANN: DVEdit - Video Editing the Python Way

2007-11-22 Thread DavidM
Hi fellow pythonistas, I've put up an initial pre-alpha release of DVEdit - a highly pythonic free/opensource framework for scripted video editing and production. http://www.freenet.org.nz/dvedit It's in very early stages, mainly proof of concept, but I feel pretty happy with the core classes

Re: How to read gzipped utf8 file in Python?

2007-11-22 Thread Martin v. Löwis
I have a large (gigabytes) file which is encoded in UTF-8 and then compressed with gzip. I'd like to read it with the gzip module and utf8 decoding. You didn't specify the processing you want to perform. For example, this should work just fine fd = gzip.open(fname, 'rb') for line in

Re: import pysqlite2 or import sqlite3?

2007-11-22 Thread Jan Claeys
Op Wed, 21 Nov 2007 21:11:59 +0100, schreef Hertha Steck: After a second look at the error message: when I installed Gentoo, Python 2.4 was installed, I got the new version a little later. And I think I installed Pysqlite 2.3.5 separately. Python 2.5 comes with pysqlite - should I uninstall

Re: the annoying, verbose self

2007-11-22 Thread Kay Schluehr
On Nov 22, 8:43 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Colin J. Williams a écrit : [EMAIL PROTECTED] wrote: Alexy: Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better-

tidy project file organization (modules and tests)

2007-11-22 Thread bramble
What's the customary way to organize your project files -- particularly modules? Does the following look correct? my_project/ main_script.py doc/ [...] whatever/ [...] lib/ mymod1.py mymod2.py test/

Re: trace module and doctest

2007-11-22 Thread John J. Lee
[EMAIL PROTECTED] writes: I am trying to use the trace module with the --count flag to test for statement coverage in my doctests. The trace coverage listing is very weird, marking many statements as unexecuted which were clearly executed during the run (I can see their output on the

Re: Python too complex ?!?!?!

2007-11-22 Thread John J. Lee
Chris Mellon [EMAIL PROTECTED] writes: On Nov 20, 2007 2:43 PM, John J. Lee [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] writes: [...] These modules exist, but aren't that common. Certainly anything you're likely to be using in an introductory compsci course is well packaged.

Re: Python too complex ?!?!?!

2007-11-22 Thread Brian
Chris Mellon wrote: On Nov 20, 2007 2:43 PM, John J. Lee [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] writes: [...] These modules exist, but aren't that common. Certainly anything you're likely to be using in an introductory compsci course is well packaged. And even if it's not,

How to import xplt, pylab?

2007-11-22 Thread Caren Balea
Hello, I'm newbie to python. So far, I'm a bit disappointed. It's awful to set Python up to work. It's not working!!! Ok, calm down. Here are my settings: I'm using Windows XP machine and have installed Python 2.5.1. Also, I have also installed something called Cygwin to type in my commands.

Re: Python web frameworks

2007-11-22 Thread Graham Dumpleton
On Nov 23, 4:00 am, Istvan Albert [EMAIL PROTECTED] wrote: On Nov 21, 12:15 am, Graham Dumpleton [EMAIL PROTECTED] wrote: I would say that that is now debatable. Overall mod_wsgi is probably a better package in terms of what it has to offer. Only thing against mod_wsgi at this point is

Re: Clean way to get one's network IP address?

2007-11-22 Thread John J. Lee
Gilles Ganault [EMAIL PROTECTED] writes: I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast:192.168.0.255 Mask:255.255.255.0 I

Re: the annoying, verbose self

2007-11-22 Thread Paul Boddie
On 22 Nov, 20:24, Ayaz Ahmed Khan [EMAIL PROTECTED] wrote: I've never really understood why some people find that annoying to do. I make it a point to use, for example, the `this` operator when writing C++ code to avoid implicilty calling/accessing attributes of objects as much as possible.

Re: Python web frameworks

2007-11-22 Thread TYR
Perhaps we need a pythonic FRONTEND. If you're meant to be able to run java code in a browser vm; and flash; and javascript...why not a reduced version of python? I'm thinking a sandboxed interpreter, perhaps based on EmbeddedPython, and a restricted set of classes; core logic, string and maths,

Re: Next float?

2007-11-22 Thread Mark Dickinson
On Nov 22, 5:41 pm, Mark Dickinson [EMAIL PROTECTED] wrote: On Nov 21, 11:48 pm, Mark T [EMAIL PROTECTED] wrote: Here's some functions to get the binary representation of a float. Then just manipulate the bits (an exercise for the reader): import struct def f2b(f): return

Re: Next float?

2007-11-22 Thread Mark Dickinson
On Nov 21, 11:48 pm, Mark T [EMAIL PROTECTED] wrote: Here's some functions to get the binary representation of a float. Then just manipulate the bits (an exercise for the reader): import struct def f2b(f): return struct.unpack('I',struct.pack('f',f))[0] def b2f(b): return

The Python Papers is looking for additional Associate Editors

2007-11-22 Thread maurice ling
The Python Papers (http://pythonpapers.org), ISSN 1834-3147, is an online e-journal, covering articles on Python in the community, industry and academia. We were established in the second half of 2006 and launched our first issue in November 2006. Since then, we have released 3 more issues.

Re: How to import xplt, pylab?

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 02:00:00PM -0800, Caren Balea wrote regarding How to import xplt, pylab?: Hello, I'm newbie to python. So far, I'm a bit disappointed. It's awful to set Python up to work. It's not working!!! Ok, calm down. Here are my settings: I'm using Windows XP machine

Re: How to import xplt, pylab?

2007-11-22 Thread Caren Balea
On 22 Nov, 23:17, J. Clifford Dyer [EMAIL PROTECTED] wrote: On Thu, Nov 22, 2007 at 02:00:00PM -0800, Caren Balea wrote regarding How to import xplt, pylab?: Hello, I'm newbie to python. So far, I'm a bit disappointed. It's awful to set Python up to work. It's not working!!!

Re: the annoying, verbose self

2007-11-22 Thread braver
On Nov 23, 1:15 am, Paul Boddie [EMAIL PROTECTED] wrote: One wonders whether the people complaining so vehemently about self have ever encountered coding style guides. Dude, I'm also programming in Ada, 83 to 95 to 2005. Beautiful language, a living style guide. I love typing names dozens of

Not forking?

2007-11-22 Thread Gilles Ganault
Hello I'd like to rewrite the following Perl script in Python: http://www.voip-info.org/wiki/view/Asterisk+NetCID It seems like the following doesn't actually fork, so Asterisk is stuck until the script ends: === import socket,sys,time,os def sendstuff(data):

  1   2   >