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

2007-09-02 Thread Paul Rubin
Russ [EMAIL PROTECTED] writes: try: blah blah with as many return statements as you want finally: something that gets executed unconditionally at the end Thanks. I didn't think of that. So design by contract *is* relatively easy to use in Python already. The main issue, I suppose,

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

2007-09-02 Thread dmitrey
howto compile recursively all *.py files to *.pyc (from a directory my_dir)? Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

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

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. It

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 if

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) for t

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

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 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: 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.strcoll(x,y)))

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: 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 of the

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

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 concerned yourself with

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

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

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.net. So

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 = [0] *

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

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 optimiser

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 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 optimiser

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]: [function a at 0xb7792e2c, function b at 0xb779e1ec] In [59]: funcs[0]() Out[59]: 1 In [60]: funcs[1]() Out[60]: 2 and

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 conditioner's

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: 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, cmp=lambda x,y:

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 gone, as well as the

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 use find or

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 python than

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: 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

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,

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 libraries,

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 turning off

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 same algorithm

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=locale.strcoll(x,y)))

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: 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

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 python. Use should

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 message

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

2007-09-02 Thread Alex Martelli
Paul Rubin http://[EMAIL PROTECTED] 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) a =

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 =

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: 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 of xrange

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 handy? TIA,

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(sorted(a,

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

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 beginning

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: 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

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: 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 increment a few

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 spam( l )

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 before

Re: Glade + Python = No GUI

2007-09-02 Thread Wildemar Wildenburger
Kveldulv wrote: When interrupted, I get File gui.py, line 11, in module 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: 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 module gtk.main() Ah, I see now. Thats just telling you that *you* interrupted the function/method/whateverthatis. When GUI coded manually, all

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 above

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

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'.

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 throughout

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

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: 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! diez

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 =

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 --

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 (at least in

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 code is further

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: 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: 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 a

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 on

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

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

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 implemented like Java.

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 allmost

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=106thread=211200 -- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-list

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 module 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: 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

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=106thread=211200 Thanks. I whish there would be a project for rewritting the C interpreter to make it better

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 default

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

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 (although you

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 further

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 --

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 learnt

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: 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=106thread=211200 Thanks. I whish there would be a

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, I

[issue1071] unicode.translate() doesn't error out on invalid translation table

2007-09-02 Thread Georg Brandl
Georg Brandl added the comment: Marc-Andre Lemburg schrieb: Marc-Andre Lemburg added the comment: Nice idea, but why don't you use a dictionary iterator (PyDict_Next()) for the fixup ? I thought that is unsafe to use when the dictionary is mutated while iterating.

[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Martin v. Löwis
Martin v. Löwis added the comment: It definitely sounds like a compiler bug. Unless you can provide further details to the specific error in the C code of Python, it's likely that we can do little about it. If you want to analyze this further, here is a number of things you can try: - compile

[issue1085] OS X 10.5.x Build Problems

2007-09-02 Thread Martin v. Löwis
Martin v. Löwis added the comment: This is a duplicate of #1078. -- nosy: +loewis resolution: - duplicate status: open - closed superseder: - cachersrc.py using tuple unpacking args __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1085

[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders
Simon Anders added the comment: Martin, you are right: is is related to compiler optimization. I have boiled it down to a call of stringlib_find (defined in Python-2.5.1/Objects/stringlib/find.h) and this runs fine with 'icc -O2' but incorrectly for 'icc -O3'. (The test code is attached.) So,

[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Martin v. Löwis
Martin v. Löwis added the comment: If you are curious, we could now try to find out what precisely goes wrong. The procedure would be this * after each step, check whether the problem still occurs a) resolve the includes manually, then strip everything that isn't needed. This could start with

[issue1071] unicode.translate() doesn't error out on invalid translation table

2007-09-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Ah, I hadn't noticed that you're actually manipulating the input dictionary. You should create a copy and fix that instead of changing the dict that the user passed in to the function. You can then use PyDict_Next() for fast iteration over the original

[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders
Simon Anders added the comment: Martin: I've boiled down the test case a bit more and removed all Python-specific types and macros, so that it can now be compiled stand-alone. (Updated test case 'findtest.c' attached.) I didn't feel like diving into the code much deeper, and so I have sent it to

[issue1086] test_email failed

2007-09-02 Thread xyb
New submission from xyb: test test_email failed -- Traceback (most recent call last): File /home/xyb/Python-3.0a1/Lib/email/test/test_email.py, line 1445, in test_same_boundary_inner_outer msg = self._msgobj('msg_15.txt') File /home/xyb/Python-3.0a1/Lib/email/test/test_email.py, line 67,

[issue1086] test_email failed

2007-09-02 Thread Peter van Kampen
Peter van Kampen added the comment: Attached is msg_15.txt encoded in utf-8. f = codecs.open('Lib/email/test/data/msg_15.txt', 'r', encoding='iso-8859-1') s = f.read() f.close() f = open('Lib/email/test/data/msg_15.txt','w') f.write(s) f.close() $ ./python Lib/test/regrtest.py test_email

[issue1673409] datetime module missing some important methods

2007-09-02 Thread Jon Ribbens
Jon Ribbens added the comment: Almost everything you just said about time_t is wrong. time_t is signed, and always has been (otherwise the 'end of time' for 32-bit time_t would be 2106, not 2038). Also, time_t does not end at 2038 because nothing says it must be 32 bits. Also, Python has 'long

[issue1673409] datetime module missing some important methods

2007-09-02 Thread Skip Montanaro
Skip Montanaro added the comment: Jon Almost everything you just said about time_t is wrong. time_t is Jon signed, and always has been (otherwise the 'end of time' for 32-bit Jon time_t would be 2106, not 2038). Also, time_t does not end at 2038 Jon because nothing says it must be 32

[issue1078] cachersrc.py using tuple unpacking args

2007-09-02 Thread Georg Brandl
Changes by Georg Brandl: -- assignee: - collinwinter nosy: +collinwinter __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1078 __ ___ Python-bugs-list mailing list

  1   2   >