ZODB 3.3.1 release candidate 1 released

2005-04-02 Thread Tim Peters
I'm pleased to announce the release of ZODB 3.3.1c1. In the absence of new critical bug reports, the same code will be released as ZODB 3.3.1 final in a week or two. You can download a source tarball or Windows installer from: http://zope.org/Products/ZODB3.3 There are several critical

ZODB 3.4 alpha 1 released

2005-04-02 Thread Tim Peters
I'm pleased to announce the release of ZODB 3.4 alpha 1. You can download a source tarball or Windows installer from: http://zope.org/Products/ZODB3.4 ZODB 3.4a1 contains all the bugfixes in the ZODB 3.3.1c1 released earlier today, plus new features, such as a new BTree type mapping

gthumpy: GUI to handle images

2005-04-02 Thread Thomas Guettler
GTK-GUI for images from a digital camera. You can enter metadata (date, title, description), switch between directories and display all images of a directory. You can created a slide show of static HTML files, too. The created files don't need a http server or CGI, you can burn a CD/DVD and give

Re: Simple thread-safe counter?

2005-04-02 Thread Paul Rubin
Skip Montanaro [EMAIL PROTECTED] writes: How about (untested): import Queue counter = Queue.Queue() counter.put(0) def f(): i = counter.get() counter.put(i+1) return i Hmmm, that's a bit messier than I hoped for, but it looks sure to work. I

Re: Installing Python on a Windows 2000 Server

2005-04-02 Thread Serge Orlov
Mike Moum wrote: Hi, I'm a civil engineer who also doubles as chief programmer for technical applications at my company. Most of our software is written in Visual Basic because our VP in charge of I.T. likes to have consistency, and at the moment we're a Microsoft shop. He has assigned me

Re: Installing Python on a Windows 2000 Server

2005-04-02 Thread Martin v. Löwis
Mike Moum wrote: We have a central server array running Windows Server 2000 (I think that's the right name; networking is not my specialty, but it's definately Windows). Some of our workstations run Windows 2000; others run Windows XP Pro. I would like to install Python on the server, and run

Re: unittest vs py.test?

2005-04-02 Thread Raymond Hettinger
[Peter Hansen] If py.test provides a driver utility that does effectively this, well, that's nice for users. If it doesn't run them as separate processes, it wouldn't suit me anyway. Still, it sounds like it does have a strong following of smart people: enough to make me want to take a

Re: unittest vs py.test?

2005-04-02 Thread Raymond Hettinger
[Peter Hansen] This is pretty, but I *want* my tests to be contained in separate functions or methods. In py.test, those would read: def test1(): assert a == b def test2(): raises(Error, func, args) Enclosing classes are optional. Raymond --

How to reload local namespace definitions in the python interpreter?

2005-04-02 Thread test1dellboy3
Hi, I am a beginner using the python interpreter. To reduce typing effort, I created a module called aliases.py containing some aliases for objects I commonly use like - aliases.py : import filecmp, os, commands op = os.path go = commands.getoutput dc = filecmp.dircmp p1 =

Re: Simple thread-safe counter?

2005-04-02 Thread Rob Williscroft
Tim Peters wrote in news:mailman.1223.1112417955.1799.python- [EMAIL PROTECTED] in comp.lang.python: [Paul Rubin] I'd like to have a function (or other callable object) that returns 0, 1, 2, etc. on repeated calls. That is: print f() # prints 0 print f() # prints 1 print f()

Re: Simple thread-safe counter?

2005-04-02 Thread Leif K-Brooks
Artie Gold wrote: Skip Montanaro wrote: counter = Queue.Queue() def f(): i = counter.get() I think you need: i = counter.get(True) The default value for the block argument to Queue.get is True. -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest vs py.test?

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 09:24:30 GMT, Raymond Hettinger [EMAIL PROTECTED] wrote: [Peter Hansen] If py.test provides a driver utility that does effectively this, well, that's nice for users. If it doesn't run them as separate processes, it wouldn't suit me anyway. Still, it sounds like it does

Re: Looking for Benchmarklets to improve pyvm

2005-04-02 Thread stelios xanthakis
coffeebug wrote: Newbie here (new to the language and scripting in general). I'm trying to figure out what you mean by bytecode. Do you mean a virtual python environment that can be hosted by any anonymous operating system? For example, you want to run Python programs on BEOS so you crank up

Re: How to reload local namespace definitions in the python interpreter?

2005-04-02 Thread Tim Jarman
[EMAIL PROTECTED] wrote: Hi, I am a beginner using the python interpreter. To reduce typing effort, I created a module called aliases.py containing some aliases for objects I commonly use like - aliases.py : import filecmp, os, commands op = os.path go = commands.getoutput dc =

Re: Looking for Benchmarklets to improve pyvm

2005-04-02 Thread stelios xanthakis
Skip Montanaro wrote: Take a look around for Marc Andre Lemburg's pybench suite. Thanks! Although pybench needs module.re and module.pickle, so I'll post results later. Moreover, I have similar tests. I'd prefer scripts that do *real* calculations. Stelios --

Re: Simple thread-safe counter?

2005-04-02 Thread Neil Benn
Paul Rubin wrote: Skip Montanaro [EMAIL PROTECTED] writes: How about (untested): import Queue counter = Queue.Queue() counter.put(0) def f(): i = counter.get() counter.put(i+1) return i Hmmm, that's a bit messier than I hoped for, but it looks sure to work.

Re: boring the reader to death (wasRe: Lambda: the Ultimate Design Flaw

2005-04-02 Thread Sunnan
Tim Peters wrote: [Aahz] The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death. --GvR [Sunnan] Can anyone please point me to the text that quote was

Re: Ternary Operator in Python

2005-04-02 Thread Sunnan
Robert Kern wrote: Sunnan wrote: (((0.0 a) 1.0) b ) 2.0 Go on. Try it with a bunch of different values. My bad. (Of course. The subexpressions must return booleans, not the largest number. It couldn't work any other way.) Egg on my face, and all that (figuratively speaking). Not used to

Re: pagecrawling websites with Python

2005-04-02 Thread Swaroop C H
On 1 Apr 2005 11:58:11 -0800, writeson [EMAIL PROTECTED] wrote: We've got an application we wrote in Python called pagecrawler that snip / Does anyone have any insight if this is a reasonable approach to build web pages, or if we should look at another design? I don't have an answer to your

How To Do It Faster?!?

2005-04-02 Thread andrea_gavana
Hello Simo NG, Correct me if I'm wrong but since it _seems_ that the listing doesn't need to be up-to-date each minute/hour as the users will be looking primarily for old/unused files, why not have a daily cronjob on the Unix server to produce an appropriate file list on e.g. the root directory

Re: boring the reader to death (wasRe: Lambda: the Ultimate DesignFlaw

2005-04-02 Thread Scott David Daniels
Sunnan wrote: ...Because what is boring? The opposite of dense, tense, intense. Utterly predictable; it's like the combination of all my prejudices. Even before I knew, I thought Bet Python separates statements from expressions. Python is for terse, pithy prose; Python is not for poetry. --Scott

Re: Ternary Operator in Python

2005-04-02 Thread Scott David Daniels
Roy Smith wrote: ... How our tools warp our thinking. That is what it means to be human. I can think of no better reason for a programmer to regularly learn languages: our tools warp our thinking. A programmer is a professionally warped thinker. --Scott David Daniels [EMAIL PROTECTED] --

Re: Lambda: the Ultimate Design Flaw

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 00:40:15 -0500, Steve Holden [EMAIL PROTECTED] wrote: The danger in GOTO is that it allows the undisciplined programmer to develop a badly-structured solution to a programming problem. A disciplined programmer will write well-structured code with whatever tools come to

Re: Python plug-in Frameworks like Eclipse RCP...

2005-04-02 Thread Diez B. Roggisch
Jim Hargrave wrote: Hum, maybe my question was too specific. What I would really like to know is what is the best way to implement a Python application with a pluggable architecture. In particular, I would like to use wxPython and have plug ins automatically register themselves with the GUI

Re: unittest vs py.test?

2005-04-02 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Bengt Richter) Is there a package that is accessible without svn? That seems to be its weak point right now. Fortunately, you can get pre-built svn clients for many platforms (http://subversion.tigris.org/project_packages.html#binary-packages),

Re: __init__ method and raising exceptions

2005-04-02 Thread NavyJay
Or better yet, define your own string/class exception to catch your errors. In my code, things can break in more than a few ways. In each case I catch the exception(s) specific to that piece of code, print a warning message to the user at sys.stdout and raise a new exception to be caught by my

Docorator Disected

2005-04-02 Thread Ron_Adam
I was having some difficulty figuring out just what was going on with decorators. So after a considerable amount of experimenting I was able to take one apart in a way. It required me to take a closer look at function def's and call's, which is something I tend to take for granted. I'm not

[EVALUATION] - E03 - jamLang Evaluation Case Applied to Python

2005-04-02 Thread Ilias Lazaridis
[EVALUATION] - E02 - Support for MinGW Open Source Compiler http://groups-beta.google.com/group/comp.lang.python/msg/f5cd74aa26617f17 - In comparison to the E02 thread, now a more practical one. - Here is a simple evaluation template (first part) which can be applied to the Python language:

terminating an inactive process

2005-04-02 Thread Earl Eiland
I'm running a PyWin program that executes another program using subprocess.Popen(). Unfortunately, this other program isn't well behaved, and frequently terminates without terminating its process. After this happens enough times, all my memory is tied up, and the machine crashes. Using

Re: Module subprocess: How to communicate more than once?

2005-04-02 Thread Peter Hansen
Edward C. Jones wrote: I have a program named octave (a Matlab clone). It runs in a terminal, types a prompt and waits for the user to type something. If I try # Run octave. oct = subprocess.Popen(octave, stdin=subprocess.PIPE) # Run an octave called startup. oct.communicate(startup) # Change

Re: Docorator Disected

2005-04-02 Thread El Pitonero
Ron_Adam wrote: # (0) Read defined functions into memory def decorator(d_arg): # (7) Get 'Goodbye' off stack def get_function(function): # (8) Get func object off stack def wrapper(f_arg):# (9) Get 'Hello' off stack new_arg = f_arg+'-'+d_arg

Re: unittest vs py.test?

2005-04-02 Thread Peter Hansen
Roy Smith wrote: Actually, I believe it does. I'm just starting to play with this, but it looks like you can do: py.test test_sample.py and it'll run a single test file. Well, my driver script can do that too. I just meant I could do test_sample.py and have it run the test any time, if I

Re: unittest vs py.test?

2005-04-02 Thread Peter Hansen
Raymond Hettinger wrote: [Peter Hansen] This is pretty, but I *want* my tests to be contained in separate functions or methods. In py.test, those would read: def test1(): assert a == b def test2(): raises(Error, func, args) Enclosing classes are optional. So basically py.test skips the

Re: terminating an inactive process

2005-04-02 Thread fred.dixon
i use this to open/close netscape as it also doesnt like to close all the time. its a WMI script but easiely edited. check out script-o-matic from ms-downloads , it outputs python code as well as others. ## strComputer = . Set

Re: Simple thread-safe counter?

2005-04-02 Thread Artie Gold
Leif K-Brooks wrote: Artie Gold wrote: Skip Montanaro wrote: counter = Queue.Queue() def f(): i = counter.get() I think you need: i = counter.get(True) The default value for the block argument to Queue.get is True. Right. I misparsed the entry in the documentation: If

Re: boring the reader to death (wasRe: Lambda: the Ultimate DesignFlaw

2005-04-02 Thread Donn Cave
Quoth Scott David Daniels [EMAIL PROTECTED]: | Sunnan wrote: | ...Because what is boring? The opposite of dense, tense, intense. Utterly | predictable; it's like the combination of all my prejudices. Even before | I knew, I thought Bet Python separates statements from expressions. | | Python

Re: redundant importr

2005-04-02 Thread max(01)*
Peter Hansen wrote: max(01)* wrote: Peter Hansen wrote: Not required except for performance reasons. If the .pyc files don't exist, the .py files are recompiled and the resulting bytecode is simply held in memory and not cached and the next startup will recompile all over again. but the other

Performance issue

2005-04-02 Thread Tom Carrick
Hi, In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm not willing to think it's just python being slow, so I was hoping someone could find a faster way of

instance name

2005-04-02 Thread max(01)*
hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs -- http://mail.python.org/mailman/listinfo/python-list

Re: instance name

2005-04-02 Thread Andrew Koenig
max(01)* [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there a way to define a class method which prints the instance name? The term the instance name is misleading, because it assumes, without saying so explicitly, that every instance has a unique name. In fact, there is no

Re: instance name

2005-04-02 Thread Irmen de Jong
max(01)* wrote: hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs What should the following do,

Re: instance name

2005-04-02 Thread max(01)*
Andrew Koenig wrote: max(01)* [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there a way to define a class method which prints the instance name? The term the instance name is misleading, because it assumes, without saying so explicitly, that every instance has a unique name.

Re: instance name

2005-04-02 Thread max(01)*
Irmen de Jong wrote: max(01)* wrote: hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs What should the following do,

Example Code : Shared Memory with Mutex (pywin32 and ctypes)

2005-04-02 Thread Srijit Kumar Bhadra
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with SharedMemAccess_Mutex_ctypes.py or SharedMemAccess_Mutex_win32all.py #~ a) Creates a shared memory #~ b) Creates or Opens

Re: Performance issue

2005-04-02 Thread Irmen de Jong
Tom Carrick wrote: Hi, In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm not willing to think it's just python being slow, so I was hoping someone could

Re: boring the reader to death (wasRe: Lambda: the Ultimate Design Flaw

2005-04-02 Thread Aahz
In article [EMAIL PROTECTED], Sunnan [EMAIL PROTECTED] wrote: [Aahz] The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death. --GvR It's just that

Re: Performance issue

2005-04-02 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Tom Carrick wrote: [] Also, I was wondering if there was a more builtin, or just nicer way of converting a string to a list (or using the sort function on a list) than making a function for it. Use the `list()` builtin on the string and *just* the `sort()` method:: In

Re: Docorator Disected

2005-04-02 Thread Kay Schluehr
Ron_Adam wrote: def decorator(d_arg): # (7) Get 'Goodbye' off stack def get_function(function): # (8) Get func object off stack def wrapper(f_arg):# (9) Get 'Hello' off stack new_arg = f_arg+'-'+d_arg result = function(new_arg) # (10) Put

Re: Performance issue

2005-04-02 Thread vincent wehren
Tom Carrick [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] | Hi, | | In my attempted learning of python, I've decided to recode an old | anagram solving program I made in C++. The C++ version runs in less | than a second, while the python takes 30 seconds. I'm not willing to |

Re: Performance issue

2005-04-02 Thread Thomas Rast
Tom Carrick [EMAIL PROTECTED] writes: In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. Indeed, your program can be improved to run about ten times as fast,

Re: Docorator Disected

2005-04-02 Thread Ron_Adam
On 2 Apr 2005 07:22:39 -0800, El Pitonero [EMAIL PROTECTED] wrote: Is it possible that you mistakenly believe your @decorator() is being executed at the line func('Hello')? Please add a print statement to your code: def decorator(d_arg): def get_function(function): print

Re: Ternary Operator in Python

2005-04-02 Thread Steven Bethard
Scott David Daniels wrote: Roy Smith wrote: ... How our tools warp our thinking. That is what it means to be human. I can think of no better reason for a programmer to regularly learn languages: our tools warp our thinking. A programmer is a professionally warped thinker. --Scott David Daniels

Re: Simple thread-safe counter?

2005-04-02 Thread Aahz
In article [EMAIL PROTECTED], Skip Montanaro [EMAIL PROTECTED] wrote: Obviously, if you want multiple counters for some reason a little information hiding with a class would help (also untested): import Queue class Counter: def __init__(self, start=0): self.counter

Re: Docorator Disected

2005-04-02 Thread Diez B. Roggisch
statements documenting the flow in a few minutes. I'm still a bit fuzzy on how the arguments are stored and passed. The arguments are part of the outer scope of the function returned, and thus they ar kept around. That's standart python,too: def foo(): a = 10 def bar(): return

Name of IDLE on Linux

2005-04-02 Thread Edward Diener
What is the name of the IDLE program on Linux and where is it installed in a normal Linux distribution ? I have installed all the Python 2.3.5 RPMs on my Fedora 3 system but I have no idea where they are installed or what IDLE is called. I lloked in the Python web pages to try to find a list

Can I play too?

2005-04-02 Thread Scott David Daniels
Thomas Rast wrote: Tom Carrick [EMAIL PROTECTED] writes: In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. Indeed, your program can be improved to run about ten

Re: Decorater inside a function? Is there a way?

2005-04-02 Thread George Sakkis
It turns out it's not a how to inflate tires with a hammer request; I've actually written an optional type checking module using decorators. The implementation details are not easy to grok, but the usage is straightforward: from typecheck import * @returns(listOf(int, size=3)) @expects(x=str,

Re: Performance issue

2005-04-02 Thread Shalabh Chaturvedi
Tom Carrick wrote: Hi, In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm not willing to think it's just python being slow, so I was hoping someone could find a

Re: Name of IDLE on Linux

2005-04-02 Thread Jim Benson
On Sat, 2 Apr 2005, Edward Diener wrote: What is the name of the IDLE program on Linux and where is it installed in a normal Linux distribution ? I have installed all the Python 2.3.5 RPMs on my Fedora 3 system but I have no idea where they are installed or what IDLE is called. I lloked in

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 19:59:30 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: statements documenting the flow in a few minutes. I'm still a bit fuzzy on how the arguments are stored and passed. The arguments are part of the outer scope of the function returned, and thus they ar kept around.

Re: boring the reader to death (wasRe: Lambda: the Ultimate DesignFlaw

2005-04-02 Thread Scott David Daniels
Donn Cave wrote: Quoth Scott David Daniels [EMAIL PROTECTED]: | Sunnan wrote: | ...Because what is boring? The opposite of dense, tense, intense. Utterly | predictable; it's like the combination of all my prejudices. Even before | I knew, I thought Bet Python separates statements from

Re: Performance issue

2005-04-02 Thread Shalabh Chaturvedi
Tom Carrick wrote: Hi, In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm not willing to think it's just python being slow, so I was hoping someone could find a

Re: Can I play too?

2005-04-02 Thread stelios xanthakis
Scott David Daniels wrote: if __name__ == '__main__': import sys main(sys.argv[1:] or ['anagrams.py']) This is *exactly* the kind of testcases I'm looking for to test the soon-to-be-released pyvm. Great! I'll be back with results. For now, a fast anagrams.py is

Re: Decorator Dissection

2005-04-02 Thread Diez B. Roggisch
I followed that part. The part that I'm having problems with is the first nested function get's the argument for the function name without a previous reference to the argument name in the outer frames. So, a function call to it is being made with the function name as the argument, and that

Re: Pseudocode in the wikipedia

2005-04-02 Thread Cameron Laird
In article [EMAIL PROTECTED], Ivan Van Laningham [EMAIL PROTECTED] wrote: . . . 25 25 (_ | _) 25 There's clearly some interesting biometrics research to be done here, although there is a well-known ass-capturing

Re: Controling the ALU

2005-04-02 Thread Chris Smith
Cesar == Cesar Andres Roldan Garcia [EMAIL PROTECTED] writes: Cesar Hi How can I control an ALU from a PC using Python? Cesar Thanks! Cesar Hola... Cesar Como puedo controlar la ALU de un PC usando Pyhton? Cesar Gracias! Cesar -- Atentamente, Cesar Cesar Andres

Re: How To Do It Faster?!?

2005-04-02 Thread Simo Melenius
[EMAIL PROTECTED] writes: $ find . -type f -printf %T@ %u %s %p\n /yourserverroot/files.txt That is a nice idea. I don't know very much about Unix, but I suppose that on a ksh I can run this command (or a similar one) in order to obtain the list I need. If anyone knows if that command will

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On 2 Apr 2005 08:39:35 -0800, Kay Schluehr [EMAIL PROTECTED] wrote: There is actually nothing mysterious about decorators. I've heard this quite a few times now, but *is* quite mysterious if you are not already familiar with how they work. Or instead of mysterious, you could say complex, as

Re: Suggesting methods with similar names

2005-04-02 Thread bearophileHUGS
Is that last idea so stupid? Still, I'd like to know if you know some little Python search engines for such purpose. Thank you, Bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Pseudocode in the wikipedia

2005-04-02 Thread Ivan Van Laningham
Hi All-- Cameron Laird wrote: Welcome back, Ivan. Your follow-ups make one wonder about the span of related topics clp has been missing in your absence. Thanks for the welcome. Absence was more a consequence of working for idiots for four years (at 60-80 hours/week) than anything else.

Re: Name of IDLE on Linux

2005-04-02 Thread Edward Diener
Jim Benson wrote: On Sat, 2 Apr 2005, Edward Diener wrote: What is the name of the IDLE program on Linux and where is it installed in a normal Linux distribution ? I have installed all the Python 2.3.5 RPMs on my Fedora 3 system but I have no idea where they are installed or what IDLE is

Re: Simple thread-safe counter?

2005-04-02 Thread Paul Rubin
[EMAIL PROTECTED] (Aahz) writes: This is one case where'd recommend using a plan RLock() instead of using Queue -- the RLock() will be more efficient... I'm starting to believe the GIL covers up an awful lot of sloppiness in Python. I wonder if there could be a decorator approach:

Re: Decorator Dissection

2005-04-02 Thread El Pitonero
Ron_Adam wrote: On 2 Apr 2005 08:39:35 -0800, Kay Schluehr [EMAIL PROTECTED] wrote: There is actually nothing mysterious about decorators. I've heard this quite a few times now, but *is* quite mysterious if you are not already familiar with how they work. Or instead of mysterious, you

testing -- what to do for testing code with behaviour dependant upon which files exist?

2005-04-02 Thread Brian van den Broek
Hi all, I'm just starting to employ unit testing (I'm using doctest), and I am uncertain how to handle writing tests where the behaviour being tested is dependant on whether certain file paths point to actual files. I have a class which takes, in its __init__, a list of file paths to process.

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 21:04:57 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: I followed that part. The part that I'm having problems with is the first nested function get's the argument for the function name without a previous reference to the argument name in the outer frames. So, a

Re: Decorator Dissection

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 18:39:41 GMT, Ron_Adam [EMAIL PROTECTED] wrote: def foo(): a = 10 def bar(): return a*a return bar print foo()() --- *Here* No decorator-specific magic here - just references kept to outer frames which form the scope for the inner function.

Re: Performance issue

2005-04-02 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Tom Carrick wrote: In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm not willing to think it's just python being slow, so I was

Re: Name of IDLE on Linux

2005-04-02 Thread Thomas Rast
Edward Diener [EMAIL PROTECTED] writes: It is a pity the Python Linux binary installations do not create folders on the desktop or in the Gnome menu system with links to the Python to the documentation and a readme telling me what executables were installed. Imagine they did, and the other

Re: Docorator Disected

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 14:29:08 GMT, Ron_Adam [EMAIL PROTECTED] wrote: I was having some difficulty figuring out just what was going on with decorators. So after a considerable amount of experimenting I was able to take one apart in a way. It required me to take a closer look at function def's

Re: testing -- what to do for testing code with behaviour dependant upon which files exist?

2005-04-02 Thread Andr Malo
* Brian van den Broek wrote: The relevant part of the validation method code looks like: # self.universe_files is a list of file paths non_existent_files = [ x for x in self.universe_files if not os.path.isfile(x) ] if

Re: Performance issue

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 10:29:19 -0800, Shalabh Chaturvedi [EMAIL PROTECTED] wrote: Tom Carrick wrote: Hi, In my attempted learning of python, I've decided to recode an old anagram solving program I made in C++. The C++ version runs in less than a second, while the python takes 30 seconds. I'm

Re: Performance issue

2005-04-02 Thread Steven Bethard
Marc 'BlackJack' Rintsch wrote: def make_anagram_map(words): anagram_map = dict() for word in imap(lambda w: w.strip().lower(), words): sorted_word = ''.join(sorted(list(word))) anagram_map.setdefault(sorted_word, list()).append(word) return dict(ifilter(lambda x:

Re: Decorator Dissection

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 21:04:57 +0200, Diez B. Roggisch [EMAIL PROTECTED] wrote: I followed that part. The part that I'm having problems with is the first nested function get's the argument for the function name without a previous reference to the argument name in the outer frames. So, a

Re: redundant imports

2005-04-02 Thread Mike Meyer
max(01)* [EMAIL PROTECTED] writes: Peter Hansen wrote: max(01)* wrote: hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if python were c, code-1.c should only *include* code-2.c, because the

Re: Simple thread-safe counter?

2005-04-02 Thread Tim Peters
[Paul Rubin] I'm starting to believe the GIL covers up an awful lot of sloppiness in Python. The GIL is highly exploitable, and much of CPython does exploit it. If you don't want to exploit it, that's fine: there was always an obvious approach using an explicit mutex here, and the only thing

Re: (win32) speedfan api control

2005-04-02 Thread Claudio Grondi
your script works ok on my W2K box :-). It makes me curious if I can get also the temperatures into Python script for further processing as easy as the setting of the checkbox is done? (I have not much experience with this kind of programming yet) May I ask how did you get the TJvXPCheckbox and

Re: Docorator Disected

2005-04-02 Thread M.E.Farmer
Hello Ron , You have many good explanations already, but I thought that this __might__ help others. Like you I was confused by the decorator syntax. till I realized it was shorthand for ... def identity(f): return f def foo(): pass # this is the 'old way' foo = identity(foo) It just

Re: Simple thread-safe counter?

2005-04-02 Thread Heiko Wundram
Am Samstag, 2. April 2005 22:28 schrieb Paul Rubin: I'm starting to believe the GIL covers up an awful lot of sloppiness in Python. I wonder if there could be a decorator approach: @synchronized def counter(): t = itertools.count() while True: yield t.next()

Re: Simple thread-safe counter?

2005-04-02 Thread Heiko Wundram
Am Sonntag, 3. April 2005 00:57 schrieb Heiko Wundram: snip or Make that: create_counter = syncronized_iterator(itertools.count) and counter = create_counter() to create the actual counter regardless of iterator. -- --- Heiko. pgpuQ5CRv1IKe.pgp Description: PGP signature --

Re: Simple thread-safe counter?

2005-04-02 Thread Paul Rubin
Tim Peters [EMAIL PROTECTED] writes: If you don't want to exploit it, that's fine: there was always an obvious approach using an explicit mutex here, and the only thing stopping you from using it is a desire to be clever. Exploiting the GIL in CPython is clever; using an explicit mutex is

Re: instance name

2005-04-02 Thread Mark Winrock
max(01)* wrote: hi. is there a way to define a class method which prints the instance name? e.g.: class class_1: ... def myName(self): ... what should i do here ... instance_1 = class_1() instance_1.myName() 'instance_1' bye macs macs, The object instance doesn't know about

Re: string goes away

2005-04-02 Thread Mike Meyer
Andreas Beyer [EMAIL PROTECTED] writes: OK, you won. I read in an (regretably old) guidline for improving Python's performance that you should prefer map() compared to list comprehensions. Apparently the performance of list comprehensions has improved a lot, which is great. (Or the overhead

Re: testing -- what to do for testing code with behaviour dependant upon which files exist?

2005-04-02 Thread Grig Gheorghiu
Can't you use the tempfile module to generate unique names for non-existent files and directories? Take a look at http://www.python.org/doc/lib/module-tempfile.html -- it works on all supported platforms. Grig -- http://mail.python.org/mailman/listinfo/python-list

Re: Docorator Disected

2005-04-02 Thread Ron_Adam
On Sat, 02 Apr 2005 21:28:36 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: I think it might help you to start out with very plain decorators rather than decorators as factory functions that return decorator functions that wrap the decorated function in a wrapper function. E.g., (this could

Corectly convert from %PATH%=c:\\X; c:\\a; b TO ['c:\\X', 'c:\\a; b']

2005-04-02 Thread chirayuk
Hi, I am trying to treat an environment variable as a python list - and I'm sure there must be a standard and simple way to do so. I know that the interpreter itself must use it (to process $PATH / %PATH%, etc) but I am not able to find a simple function to do so.

Re: testing -- what to do for testing code with behaviour dependant upon which files exist?

2005-04-02 Thread Jeremy Bowers
On Sat, 02 Apr 2005 15:30:13 -0500, Brian van den Broek wrote: So, how does one handle such cases with tests? When I had a similar situation, I created a directory for testing that was in a known state, and tested on that. If you can test based on a relative directory, that should work OK.

Re: Corectly convert from %PATH%=c:\\X; c:\\a; b TO ['c:\\X', 'c:\\a; b']

2005-04-02 Thread Michael Spencer
chirayuk wrote: Hi, I am trying to treat an environment variable as a python list - and I'm sure there must be a standard and simple way to do so. I know that the interpreter itself must use it (to process $PATH / %PATH%, etc) but I am not able to find a simple function to do so.

Re: Name of IDLE on Linux

2005-04-02 Thread Edward Diener
Thomas Rast wrote: Edward Diener [EMAIL PROTECTED] writes: It is a pity the Python Linux binary installations do not create folders on the desktop or in the Gnome menu system with links to the Python to the documentation and a readme telling me what executables were installed. Imagine they

Re: redundant imports

2005-04-02 Thread Bengt Richter
On Sat, 02 Apr 2005 16:44:29 -0600, Mike Meyer [EMAIL PROTECTED] wrote: max(01)* [EMAIL PROTECTED] writes: Peter Hansen wrote: max(01)* wrote: hi everybody. suppose that code-1.py imports code-2.py and code-3.py (because it uses names from both), and that code-2.py imports code-3.py. if

Re: Decorater inside a function? Is there a way?

2005-04-02 Thread Ron_Adam
On 2 Apr 2005 10:23:53 -0800, George Sakkis [EMAIL PROTECTED] wrote: It turns out it's not a how to inflate tires with a hammer request; I've actually written an optional type checking module using decorators. The implementation details are not easy to grok, but the usage is straightforward:

  1   2   >