Re: advice about `correct' use of decorator

2007-09-02 Thread Gabriel Genellina
En Wed, 29 Aug 2007 07:32:21 -0300, BJörn Lindqvist <[EMAIL PROTECTED]> escribi�: > On 8/24/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> En Thu, 23 Aug 2007 09:20:21 -0300, BJörn Lindqvist <[EMAIL PROTECTED]> >> escribi�: >> >> > def check_user_logged_in(func): >> > def f(*args, **kwa

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Evan Klitzke
On Sun, 2007-09-02 at 17:21 -0700, llothar wrote: > I'm afraid that the GIL is killing the usefullness of python for some > types of applications now where 4,8 oder 64 threads on a chip are here > or comming soon. > > What is the status about that for the future of python? The GIL is an implement

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: A big > question mark in my mind is Lisp, which according to aficionados is > just as dynamic as Python, but has native compilers that generate > code running as fast as highly optimized C. I'm not qualified to > judge whether the lessons learnt from Lisp

PYTHONPATH not working on Windows XP (?)

2007-09-02 Thread Sergio Correia
Hi, I'm trying to add a personal folder to the path used by python in searching for packages and modules. This folder, "C:\docs\utils" , has some packages not yet ready for "site-packages". First, I tried sys.path.append("C:\docs\utils") BUT this only lasts for the current python session. Then,

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Luis M . González
On Sep 2, 11:16 pm, llothar <[EMAIL PROTECTED]> wrote: > On 3 Sep., 07:38, "Eduardo O. Padoan" <[EMAIL PROTECTED]> > wrote: > > > > No.http://www.artima.com/weblogs/viewpost.jsp?thread=211430 > > > Ops, I > > meant:http://www.artima.com/forums/threaded.jsp?forum=106&thread=211200 > > Thanks. I whi

Re: [python-win32] How can I get the parentWindow.document object?

2007-09-02 Thread MC
Re! Sorry! The good exemple is : ie = win32com.client.Dispatch("InternetExplorer.Application") window=ie.Document.parentWindow print window.name another : window.alert("Aalleerrtt") -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Neil Cerutti
On 2007-09-02, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > A big question mark in my mind is Lisp, which according to > aficionados is just as dynamic as Python, but has native > compilers that generate code running as fast as highly > optimized C. I'm not qualified to judge whether the lessons >

Re: [python-win32] How can I get the parentWindow.document object?

2007-09-02 Thread MC
Hi! > ie = win32com.client.Dispatch("InternetExplorer.Application") > doc=ie.Document.parentWindow.document Use bridge variable : window=ie.Document.parentWindow And work with : print window.Document.body.name -- @-salutations Michel Claveau -- http://mail.python.org/mailman/li

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Neil Cerutti
On 2007-09-02, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >>> (2) it is a interpretation language >> Not quite. It's compiled to byte-code - just like Java (would >> you call Java an 'interpreted language' ?) > > Python is not implemented like Java. In Java (at least in > HotSpot), the byte code is

Re: Adding attributes stored in a list to a class dynamically.

2007-09-02 Thread Brian Munroe
On Sep 2, 3:33 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > > In a nutshell, like all double-underscore methods, __setattr__ are for > overriding behaviour in your own classes. With very few exceptions, you > shouldn't need to directly call double-underscore methods (althoug

Crunchy release 0.9.8

2007-09-02 Thread André
Crunchy version 0.9.8 has been released. Crunchy is an application that transforms static html-based Python tutorials into interactive sessions within your browser (Firefox; other browsers *may* not fully support Crunchy). Crunchy is available from http://code.google.com/p/crunchy Since the last

Re: reload(sys)

2007-09-02 Thread Steven Bethard
Sönmez Kartal wrote: > I was using the XMLBuilder(xmlbuilder.py). I'm writing XML files as > "f.write(str(xml))". At execution of that line, it gives error with > description, configure your default encoding... > [and later] > > I get this when it happens: "Decoding Error: You must configure > defa

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread llothar
On 3 Sep., 07:38, "Eduardo O. Padoan" <[EMAIL PROTECTED]> wrote: > > No.http://www.artima.com/weblogs/viewpost.jsp?thread=211430 > > Ops, I meant:http://www.artima.com/forums/threaded.jsp?forum=106&thread=211200 > Thanks. I whish there would be a project for rewritting the C interpreter to make it

Re: Getting subprocesses to be hidden on Windows

2007-09-02 Thread [david]
geoffbache wrote: > As part of my efforts to write a test tool that copes with GUIs > This is dead easy on UNIX with virtual displays like Xvfb. > Can someone shed any light if it's possible on Windows Configure the virtual display first: http://en.wikipedia.org/wiki/Virtual_desktop Alternativ

Soemthing wrong w/ urllib module or something.

2007-09-02 Thread Lamonte Harris
Error Message in cmd: Traceback (most recent call last): File "wniamp_lastest5_playlist.py", line 25, in response = urllib2.urlopen(request) File "C:\Python25\lib\urllib2.py", line 121, in urlopen return _opener.open(url, data) File "C:\Python25\lib\urllib2.py", line 374, in open

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Eduardo O. Padoan
> No. http://www.artima.com/weblogs/viewpost.jsp?thread=211430 Ops, I meant: http://www.artima.com/forums/threaded.jsp?forum=106&thread=211200 -- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-list

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread Eduardo O. Padoan
On 9/2/07, llothar <[EMAIL PROTECTED]> wrote: > I'm afraid that the GIL is killing the usefullness of python for some > types of applications now where 4,8 oder 64 threads on a chip are here > or comming soon. > > What is the status about that for the future of python? > > I know that at the moment

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Chris Mellon
On 9/2/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Wildemar Wildenburger schrieb: > > Martin v. Löwis wrote: > (2) it is a interpretation language > >>> Not quite. It's compiled to byte-code - just like Java (would you call > >>> Java an 'interpreted language' ?) > >> > >> Python is not

Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-02 Thread llothar
I'm afraid that the GIL is killing the usefullness of python for some types of applications now where 4,8 oder 64 threads on a chip are here or comming soon. What is the status about that for the future of python? I know that at the moment allmost nobody in the scripting world has solved this pro

Re: Glade + Python = No GUI

2007-09-02 Thread Kveldulv
Note to myself and python noobs like me: Don't forget to set Visible to yes on main window in Glade :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Delaunay triangulation module...

2007-09-02 Thread Robert Kern
Grant Edwards wrote: > Can anybody point me to a Delaunay triangulation module (for > Win32)? I'm currently using http://flub.stuffwillmade.org/delny/ under > Linux, but I have > been unable to find a build for Windows. I don't have the tools > (or skills) to build libqhull and Pythion extensions

Re: how can I find out the process ids with a process name

2007-09-02 Thread Steven D'Aprano
On Sun, 02 Sep 2007 19:26:27 +, herman wrote: > But now I would like to do the programmically in my python script. I > know I can use ' os.system(cmd)' to execute the command 'ps -ef | grep > emacs', but how > can I pipe the output of my 'ps -ef | grep emacs' to my python script > and then run

Re: howto reload Python module?

2007-09-02 Thread Steven D'Aprano
On Sun, 02 Sep 2007 13:28:26 -0700, dmitrey wrote: > my Python module was changed in HDD (hardware disk drive), moreover, > changed its location (but still present in sys.path). how can I reload a > func "myfunc" from the module? (or howto reload whole module)? > Thank you in advance, D. You're

Re: Adding attributes stored in a list to a class dynamically.

2007-09-02 Thread Steven D'Aprano
On Sun, 02 Sep 2007 21:41:43 +, Brian Munroe wrote: > One question though, which I haven't been able to find the answer from > scouring the internet. What is the difference between calling > __setattr__ and setattr or __getattr__ and getattr, for that matter? Have you read the following? #

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Diez B. Roggisch
Wildemar Wildenburger schrieb: > Martin v. Löwis wrote: (2) it is a interpretation language >>> Not quite. It's compiled to byte-code - just like Java (would you call >>> Java an 'interpreted language' ?) >> >> Python is not implemented like Java. In Java (at least in HotSpot), >> the byte cod

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Steven D'Aprano
On Sun, 02 Sep 2007 21:00:45 +0200, Wildemar Wildenburger wrote: > Martin v. Löwis wrote: (2) it is a interpretation language >>> Not quite. It's compiled to byte-code - just like Java (would you call >>> Java an 'interpreted language' ?) >> >> Python is not implemented like Java. In Java (a

Weird gcc errors while installing "MySQL-python" module

2007-09-02 Thread Jonas Schneider
Hi guys, I´m experiencing weird error messages while installing MySQL-python with easy_install... I have no idea where the errors come from. Read the whole output at http://pastebin.com/m3859cf40 It´s really a lot... Someone got ideas? Greets Jonas -- http://mail.python.org/mailman/listinfo/p

Re: Adding attributes stored in a list to a class dynamically.

2007-09-02 Thread Brian Munroe
On Sep 2, 11:46 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > If you want to pass the attributes list it's simpler to do that > directly, avoiding *a and **k constructs. E.g.: > > def __init__(self, a, b, attrs): > self.a = a > self.b = b > for attr in attrs: > name, value =

Re: howto reload Python module?

2007-09-02 Thread Diez B. Roggisch
dmitrey schrieb: > my Python module was changed in HDD (hardware disk drive), moreover, > changed its location (but still present in sys.path). > how can I reload a func "myfunc" from the module? (or howto reload > whole module)? > Thank you in advance, D. By using *drumroll* the reload function!

howto reload Python module?

2007-09-02 Thread dmitrey
my Python module was changed in HDD (hardware disk drive), moreover, changed its location (but still present in sys.path). how can I reload a func "myfunc" from the module? (or howto reload whole module)? Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I find out the process ids with a process name

2007-09-02 Thread Michael Bentley
On Sep 2, 2007, at 12:26 PM, herman wrote: > I would like to find out all the process id with the process name > 'emacs'. > > In the shell, i can do this: > > $ ps -ef |grep emacs > root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk > root 25649 25357 0 13:55 pts/900:00:05 e

Re: Automation and scheduling of FrontPage publishing using Python

2007-09-02 Thread [EMAIL PROTECTED]
On Sep 1, 10:48 pm, Jerry <[EMAIL PROTECTED]> wrote: > andrew, > > I would try looking into Windows automation with > Python.http://www.google.com/search?q=windows+automation+pythonshould get > you started. The winGuiAuto package may help you out as it is like > have a human click and move throug

Re: how can I find out the process ids with a process name

2007-09-02 Thread Furkan KURU
the easiest but slowest way: you can send output to a file ps -ef |grep emacs > output_file and then read the file content (I believe there is a much better way) On 9/2/07, herman <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to find out all the process id with the process name > 'emacs

how can I find out the process ids with a process name

2007-09-02 Thread herman
Hi, I would like to find out all the process id with the process name 'emacs'. In the shell, i can do this: $ ps -ef |grep emacs root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk root 25649 25357 0 13:55 pts/900:00:05 emacs-snapshot-gtk rtp.c root 26319 23926 0 14:06 pts

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Mark Dickinson
On Sep 2, 7:51 am, [EMAIL PROTECTED] wrote: > The resulting executable takes 0.24 seconds to run. I'm not expecting > a scripting language to run faster than native code, but I was > surprised at how much slower it was in this case. Any ideas as to what > is causing python so much trouble in the ab

Re: Glade + Python = No GUI

2007-09-02 Thread Kveldulv
On Sep 2, 9:07 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Kveldulv wrote: > > When interrupted, I get > > > File "gui.py", line 11, in > > gtk.main() > > Ah, I see now. Thats just telling you that *you* interrupted the > function/method/whateverthatis. > > > When GUI coded manually

Re: Glade + Python = No GUI

2007-09-02 Thread Wildemar Wildenburger
Kveldulv wrote: > When interrupted, I get > > File "gui.py", line 11, in > gtk.main() > Ah, I see now. Thats just telling you that *you* interrupted the function/method/whateverthatis. > When GUI coded manually, all works. > Hence: Something in your (generated) code or XML file is corrupt

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Wildemar Wildenburger
Martin v. Löwis wrote: >>> (2) it is a interpretation language >> Not quite. It's compiled to byte-code - just like Java (would you call >> Java an 'interpreted language' ?) > > Python is not implemented like Java. In Java (at least in HotSpot), > the byte code is further compiled to machine code

Re: Adding attributes stored in a list to a class dynamically.

2007-09-02 Thread Alex Martelli
Nathan Harmston <[EMAIL PROTECTED]> wrote: > Hi, > > Sorry if the subject line of post is wrong, but I think that is what > this is called. I want to create objects with > > class Coconuts(object): > def __init__(self, a, b, *args, **kwargs): > self.a = a > self.b = b > > def sp

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Alex Martelli
Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Sep 2, 12:55 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > Mark Dickinson <[EMAIL PROTECTED]> wrote: > > > Well, for one thing, you're creating half a million xrange objects in > > > the course of the search. All the C code has > > > to do is incr

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Martin v. Löwis
>> (2) it is a interpretation language > Not quite. It's compiled to byte-code - just like Java (would you call > Java an 'interpreted language' ?) Python is not implemented like Java. In Java (at least in HotSpot), the byte code is further compiled to machine code before execution; in Python, the

Re: Pivy problem and some other stuff

2007-09-02 Thread Zentrader
> What meaningless error message are you talking about!? > > Ciao, > Marc 'BlackJack' Rintsch My mistake. It appears that this is no longer the case. And my apologies. It was probably in version 2.3 or earlier that this was a problem. Given the way that the Python community constantly

Would like to perform unpaid research work at a CS graduate school or center

2007-09-02 Thread The Eternal Squire
To all, About twenty years ago, I was admitted to a Ph.D. program for computer science. It was also around that time that I was diagnosed for chronic depression, which forced me out of that program into the working word. I had done my best since then as a software engineer, until late 2005, when

Re: Glade + Python = No GUI

2007-09-02 Thread Kveldulv
On Sep 2, 7:29 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > > Shouldnt there be more to that error message of yours? I would expect > something like "NameError: name 'gtk' is not defined"? > > Because as it seems you haven't impored gtk (only gtk.glade). So adding > "import gtk" at the b

Adding attributes stored in a list to a class dynamically.

2007-09-02 Thread Nathan Harmston
Hi, Sorry if the subject line of post is wrong, but I think that is what this is called. I want to create objects with class Coconuts(object): def __init__(self, a, b, *args, **kwargs): self.a = a self.b = b def spam( l ) return Coconuts( l.a, l.b, l.attributes ) l in a parse

Re: localizing a sort

2007-09-02 Thread Ricardo Aráoz
Alex Martelli wrote: > Ricardo Aráoz <[EMAIL PROTECTED]> wrote: >> Peter Otten wrote: >... >>> print ''.join(sorted(a, cmp=lambda x,y: locale.strcoll(x,y))) aeiouàáäèéëìíïòóöùúü >>> The lambda is superfluous. Just write cmp=locale.strcoll instead. >> No it is not : > print ''.join(

Re: Google spreadsheets

2007-09-02 Thread Michele Simionato
On Sep 2, 7:13 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > iapain <[EMAIL PROTECTED]> wrote: > > On Aug 31, 5:40 pm, Michele Simionato <[EMAIL PROTECTED]> > > wrote: > > > I would like to upload a tab-separated file to a Google spreadsheet > > > from Python. Does anybody > > > have a recipe hand

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Mark Dickinson
On Sep 2, 12:55 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Mark Dickinson <[EMAIL PROTECTED]> wrote: > > Well, for one thing, you're creating half a million xrange objects in > > the course of the search. All the C code has > > to do is increment a few integers. > > I don't think the creation

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > Reusing xranges is exactly what my code was doing Oh cool, I missed that, I was just going by the text description. Looking at the code, yes, it's re-using the xranges. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Glade + Python = No GUI

2007-09-02 Thread Wildemar Wildenburger
Kveldulv wrote: > I made simple GUI in Glade 3 (Ubuntu 7.04) consisting of only 2 > buttons. When I run > 2buttonsgui.py, no GUI pops out > > #!/usr/bin/env python > import pygtk > import gtk.glade > > class TwoButtonsGUI: > def __init__(self): > self.window = gtk.glade.XML("/home/myu

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Alex Martelli
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > ...which suggests that creating an xrange object is _cheaper_ than > > indexing a list... > > Why not re-use the xrange instead of keeping a list around? > > Python 2.4.4 (#1, Oct 23 2006, 13:58:00)

Re: Pivy problem and some other stuff

2007-09-02 Thread Marc 'BlackJack' Rintsch
On Sun, 02 Sep 2007 14:35:00 +, Zentrader wrote: > You can also use exec, but someone will tell you that the sky is going > to fall if you do. I am one of the ones who think that calling a > function with > results = [f() for f in funcs] > doesn't "work" because it gives a meaningless error m

Re: Google spreadsheets

2007-09-02 Thread Alex Martelli
iapain <[EMAIL PROTECTED]> wrote: > On Aug 31, 5:40 pm, Michele Simionato <[EMAIL PROTECTED]> > wrote: > > I would like to upload a tab-separated file to a Google spreadsheet > > from Python. Does anybody > > have a recipe handy? TIA, > > > > Michele Simionato > > Probably its irrelevant to p

Re: code check for modifying sequence while iterating over it?

2007-09-02 Thread Alex Martelli
Neal Becker <[EMAIL PROTECTED]> wrote: > After just getting bitten by this error, I wonder if any pylint, pychecker > variant can detect this error? I know pychecker can't (and I doubt pylint can, but I can't download the latest version to check as logilab's website is temporarily down for mainte

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > ...which suggests that creating an xrange object is _cheaper_ than > indexing a list... Why not re-use the xrange instead of keeping a list around? Python 2.4.4 (#1, Oct 23 2006, 13:58:00) >>> a = xrange(3) >>> print list(a) [0, 1, 2]

Re: localizing a sort

2007-09-02 Thread Alex Martelli
Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: ... > > print ''.join(sorted(a, cmp=lambda x,y: locale.strcoll(x,y))) > >> aeiouàáäèéëìíïòóöùúü > > > > The lambda is superfluous. Just write cmp=locale.strcoll instead. > > No it is not : > >>> print ''.join(sorted(a, cmp=local

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Alex Martelli
Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Sep 2, 9:45 am, [EMAIL PROTECTED] wrote: > > [snip code] > > > > Thanks for that. I realise that improving the algorithm will speed > > things up. I wanted to know why my less than perfect algorithm was so > > much slower in python than exactly the sa

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Bruno Desthuilliers
Ivan Wang a écrit : > On Sep 2, 9:45 pm, [EMAIL PROTECTED] wrote: > >>[snip code] >> >>Thanks for that. I realise that improving the algorithm will speed >>things up. I wanted to know why my less than perfect algorithm was so >>much slower in python than exactly the same algorithm in C. Even when

Re: status of Programming by Contract (PEP 316)?

2007-09-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Russ <[EMAIL PROTECTED]> wrote: > >Excellent points. As for "no strong case for adding new features to >Python specifically for design-by-contract," if you mean adding >something to language itself, I agree, but I see nothing wrong with >adding it to the standard li

Glade + Python = No GUI

2007-09-02 Thread Kveldulv
I made simple GUI in Glade 3 (Ubuntu 7.04) consisting of only 2 buttons. When I run 2buttonsgui.py, no GUI pops out #!/usr/bin/env python import pygtk import gtk.glade class TwoButtonsGUI: def __init__(self): self.window = gtk.glade.XML("/home/myusername/Desktop/ 2buttons.glade", "win

RE: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-09-02 Thread Sandipan News
Here are some steps I used to finally successfully install Python and Pythonwin on Vista Ultimate: 1. Uninstalled Python (could not see a way to uninstall Pythonwin) 2. Installed Python again (.MSI does not provide option to run as Administrator) 3. Rebooted computer 4. Installed Pythonwin with ri

Re: create Powerpoint via com

2007-09-02 Thread Alan Isaac
Well, my needs were very limited so the result is too, but in case someone else just needs to get started: http://econpy.googlecode.com/svn/trunk/utilities/mso.py Comments, suggestions, additions welcom. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Mark Dickinson <[EMAIL PROTECTED]> wrote: >On Sep 2, 9:45 am, [EMAIL PROTECTED] wrote: >> [snip code] >> >> Thanks for that. I realise that improving the algorithm will speed >> things up. I wanted to know why my less than perfect algorithm was so >> much slower in

Re: list index()

2007-09-02 Thread Francesco Guerrieri
On 9/2/07, Zentrader <[EMAIL PROTECTED]> wrote: > > On Aug 30, 11:23 am, [EMAIL PROTECTED] wrote: > > Neil, Steve, > > > > Thanks for the responses on sets. I have not used them before and was > > not even aware Python had them. I will try them out. > > And if there weren't sets you would still not

Re: Let's Unite Against Jews and Mongrels!

2007-09-02 Thread Richard B. Gilbert
Zentrader wrote: > On Aug 28, 4:50 am, "Richard B. Gilbert" <[EMAIL PROTECTED]> > wrote: > >>>Unless, of course, someone has a working "Killbot". If anyone has such >> >>a thing, please kill that "MI5victim" moron as well! > > > I reported MI5victim to [EMAIL PROTECTED] and it appears to be gon

Re: localizing a sort

2007-09-02 Thread Ricardo Aráoz
Peter Otten wrote: > Am Sat, 01 Sep 2007 18:56:38 -0300 schrieb Ricardo Aráoz: > >> Hi, I've been working on sorting out some words. >> >> My locale is : > import locale > locale.getdefaultlocale() >> ('es_AR', 'cp1252') >> >> I do : > a = 'áéíóúäëïöüàèìòù' > print ''.join(sorted(a

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Arnaud Delobelle
On Sep 2, 12:51 pm, [EMAIL PROTECTED] wrote: [...] > The resulting executable takes 0.24 seconds to run. I'm not expecting > a scripting language to run faster than native code, but I was > surprised at how much slower it was in this case. Any ideas as to what > is causing python so much trouble in

Re: Let's Unite Against Jews and Mongrels!

2007-09-02 Thread Zentrader
On Aug 28, 4:50 am, "Richard B. Gilbert" <[EMAIL PROTECTED]> wrote: >> Unless, of course, someone has a working "Killbot". If anyone has such > a thing, please kill that "MI5victim" moron as well! I reported MI5victim to [EMAIL PROTECTED] and it appears to be gone, as well as the "free air condit

Re: Pivy problem and some other stuff

2007-09-02 Thread Zentrader
On Aug 30, 8:10 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch wrote: > > A fine repy > > > In [57]: funcs = [a, b] > > In [58]: funcs > > Out[58]: [, ] > > > In [59]: funcs[0]() > > Out[59]: 1 > > > In [60]: funcs[1]() > > Out[60]: 2 > > and a "list comprehension" al

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Ivan Wang
On Sep 2, 9:45 pm, [EMAIL PROTECTED] wrote: > [snip code] > > Thanks for that. I realise that improving the algorithm will speed > things up. I wanted to know why my less than perfect algorithm was so > much slower in python than exactly the same algorithm in C. Even when > turning off gcc's optimi

Re: list index()

2007-09-02 Thread Zentrader
On Aug 30, 11:23 am, [EMAIL PROTECTED] wrote: > Neil, Steve, > > Thanks for the responses on sets. I have not used them before and was > not even aware Python had them. I will try them out. And if there weren't sets you would still not use find or index but a brute force method or dictionaries for

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Mark Dickinson
On Sep 2, 9:45 am, [EMAIL PROTECTED] wrote: > [snip code] > > Thanks for that. I realise that improving the algorithm will speed > things up. I wanted to know why my less than perfect algorithm was so > much slower in python than exactly the same algorithm in C. Even when > turning off gcc's optimi

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread jwrweatherley
[snip code] Thanks for that. I realise that improving the algorithm will speed things up. I wanted to know why my less than perfect algorithm was so much slower in python than exactly the same algorithm in C. Even when turning off gcc's optimiser with the -O0 flag, the C version is still > 100 tim

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread rzed
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: > The puzzle is: p is the perimeter of a right angle triangle with > integral length sides, {a,b,c}. which value of p < 1000, is the > number of solutions {a,b,c} maximised? > > Here's my python code: > > #!/usr/local/bin/python > > solutions

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Greg Copeland
On Sep 2, 7:20 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Sep 2, 12:51 pm, [EMAIL PROTECTED] wrote: > > > > > I'm pretty new to python, but am very happy with it. As well as using > > it at work I've been using it to solve various puzzles on the Project > > Euler site -http://projecteuler

Re: Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread Arnaud Delobelle
On Sep 2, 12:51 pm, [EMAIL PROTECTED] wrote: > I'm pretty new to python, but am very happy with it. As well as using > it at work I've been using it to solve various puzzles on the Project > Euler site -http://projecteuler.net. So far it has not let me down, > but it has proved surprisingly slow on

Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

2007-09-02 Thread jwrweatherley
I'm pretty new to python, but am very happy with it. As well as using it at work I've been using it to solve various puzzles on the Project Euler site - http://projecteuler.net. So far it has not let me down, but it has proved surprisingly slow on one puzzle. The puzzle is: p is the perimeter of a

Re: status of Programming by Contract (PEP 316)?

2007-09-02 Thread Ricardo Aráoz
Alex Martelli wrote: > Ricardo Aráoz <[EMAIL PROTECTED]> wrote: >... We should remember that the level of security of a 'System' is the same as the level of security of it's weakest component, >... >> You win the argument, and thanks you prove my point. You typically >> conce

ANN: Python bindings for mjpegtools (yuv4mpeg)

2007-09-02 Thread DavidM
Hi, I've built some bindings for the yuv4mpeg API, supporting both Python and C++. http://www.freenet.org.nz/pyyuv4mpeg/ Based on SWIG, implements virtually the whole API as given in yuv4mpeg.h, and also implements a high-level 'Stream' class in both C++ and Python. These bindings allow easy cr

Re: So what exactly is a complex number?

2007-09-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Tim Daneliuk wrote: > No, but go to my other example of an aircraft in flight and winds > aloft. It is exactly the case that complex numbers provide a convenient > way to add these two "vectors" (don't wince, please) to provide the > effective speed and direction o

Re: howto compile recursively all *.py files to *.pyc (from a directory my_dir)?

2007-09-02 Thread Arnaud Delobelle
On Sep 2, 7:21 am, dmitrey <[EMAIL PROTECTED]> wrote: > howto compile recursively all *.py files to *.pyc (from a directory > my_dir)? > Thank you in advance, D. import compileall compileall.compile_dir('my/python/project/') -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: localizing a sort

2007-09-02 Thread Peter Otten
Am Sat, 01 Sep 2007 18:56:38 -0300 schrieb Ricardo Aráoz: > Hi, I've been working on sorting out some words. > > My locale is : import locale locale.getdefaultlocale() > ('es_AR', 'cp1252') > > I do : a = 'áéíóúäëïöüàèìòù' print ''.join(sorted(a, cmp=lambda x,y: locale.strcol

Re: How best to dynamically define methods (and functions)?

2007-09-02 Thread Bjoern Schliessmann
Kenneth McDonald wrote: > I can see an obvious but hacky way to define a Python function at > runtime. What way is this? All Python function definitions in your code are executed at runtime. > In case it's of interest in the context of the question, I need to > define a largish set of functions

Re: Windows Media Player Playlist

2007-09-02 Thread Tim Golden
Lamonte Harris wrote: > Is it possible to use python to get the current playlist of the current > playing songs from Windows Media Player or Windows Player Classic? I don't know what the answer is (not least because I never use Windows Media Player) but a good guideline for this sort of question

Re: How best to dynamically define methods (and functions)?

2007-09-02 Thread Diez B. Roggisch
Kenneth McDonald schrieb: > I can see an obvious but hacky way to define a Python function at > runtime. I can't see any obvious way to add a method to a class at > runtime (though I'm sure one could do just about anything by digging > into the metaclass stuff, which I will do if needed). But po

Re: How can I wait for all the threads I spawn for 5 minutes

2007-09-02 Thread Bryan Olson
herman wrote: > In my python program, I would to like to spwan 5 threads, for the them > for 5 minutes maximum and the continue. Here is my script: > > threads = [] > > for j in range(5): > t = MyThread() > threads.append(t) > >

Re: status of Programming by Contract (PEP 316)?

2007-09-02 Thread Russ
On Sep 1, 11:04 pm, Paul Rubin wrote: > I still don't understand why you don't like the decorator approach, > which can easily implement the above. Well, maybe decorators are the answer. If a function needs only one decorator for all the conditions and invariants (pre and post- conditions), and i

Re: So what exactly is a complex number?

2007-09-02 Thread Bryan Olson
Tim Daneliuk wrote: > Grzegorz Słodkowicz wrote: [...] >> You're mixing definition with application. You didn't say a word about >> what complex numbers are, not a word about the imaginary unit, where > > I was trying to motivate the idea by means of analogy. This is a > legitimate thing to do.

Re: status of Programming by Contract (PEP 316)?

2007-09-02 Thread Russ
On Sep 1, 10:05 pm, Russ <[EMAIL PROTECTED]> wrote: > changing the language itself. Someone please correct me if I am wrong, > but I think PEP adds only to the libraries. I meant to write PEP 316, of course. -- http://mail.python.org/mailman/listinfo/python-list