Re: StopIteration in the if clause of a generator expression

2005-04-03 Thread Peter Otten
Raymond Hettinger wrote: (quoting Bengt) I assumed that all standard sequence consumers (including list, of course) would intercept the StopIteration of a sequence given them in the form of a generator expression, so your lyst example would have an analogue for other sequence consumers as

the bugs that try men's souls

2005-04-03 Thread Sean McIlroy
This needs some background so bear with me. The problem: Suppose p is a permutation on {0...n} and t is the transposition that switches x and y [x,y in {0...n}]. A stepup pair (just a term I invented) for p is a pair (a,b) of integers in {0...n} with ab. A stepup pair (a,b) for p is an inversion

Re: Docorator Disected

2005-04-03 Thread El Pitonero
Martin v. Löwis wrote: Ron_Adam wrote: No, I did not know that you could pass multiple sets of arguments to nested defined functions in that manner. Please read the statements carefully, and try to understand the mental model behind them. He did not say that you can pass around multiple

Re: StopIteration in the if clause of a generator expression

2005-04-03 Thread Peter Otten
jfj wrote: To make it a bit clearer, a StopIteration raised in a generator expression silently terminates that generator: *any* exception raised from a generator, terminates the generator Yeah, but StopIteration is the only expected exception and therefore the only one that client code

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

2005-04-03 Thread George Sakkis
Yes, it is possible to turn off type checking at runtime; just add this in the beginning of your define: def define(func): if not ENABLE_TYPECHECKING: return lambda func: func # else decorate func where ENABLE_TYPECHECKING is a module level variable that can be exposed to the

Re: Name of IDLE on Linux

2005-04-03 Thread Peter Otten
Joal Heagney wrote: If you're using KDE, you can set a bookmark in konqueror to the documentation and it'll bring it up in the bookmark toolbar. Only hassle is when you update python and the docs, you have to edit the bookmark. Or you can bookmark a symlink to the documentation and bookmark

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

2005-04-03 Thread chirayuk
Michael Spencer wrote: 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

Re: the bugs that try men's souls

2005-04-03 Thread Serge Orlov
Sean McIlroy wrote: This needs some background so bear with me. The problem: Suppose p is a permutation on {0...n} and t is the transposition that switches x and y [x,y in {0...n}]. A stepup pair (just a term I invented) for p is a pair (a,b) of integers in {0...n} with ab. A stepup pair

Re: redundant imports

2005-04-03 Thread Serge Orlov
Mike Meyer wrote: The semantic behavior of include in C is the same as from module import * in python. Both cases add all the names in the included namespace directly to the including namespace. This usage is depreciated in Python ... Did you mean discouraged? Or it's really slated for

text analysis in python

2005-04-03 Thread Maurice Ling
Hi, I'm a postgraduate and my project deals with a fair bit of text analysis. I'm looking for some libraries and tools that is geared towards text analysis (and text engineering). So far, the most comprehensive toolkit in python for my purpose is NLTK (natural language tool kit) by Edward

Re: Help with splitting

2005-04-03 Thread Reinhold Birkenfeld
George Sakkis wrote: If you don't want any null strings at the beginning or the end, an equivalent regexp is: whitespaceSplitter_2 = re.compile(\w+|\s+) whitespaceSplitter_2.findall(1 2 3 \t\n5) ['1', ' ', '2', ' ', '3', ' \t\n', '5'] whitespaceSplitter_2.findall( 1 2 3 \t\n5 )

Re: unittest vs py.test?

2005-04-03 Thread Raymond Hettinger
[Peter Hansen] (I'm not dissing py.test, and intend to check it out. Not to be disrepectful, but objections raised by someone who hasn't worked with both tools equate to hot air. I'm just objecting to claims that unittest somehow is heavy, when those claiming that it is seem to think you

Re: unittest vs py.test?

2005-04-03 Thread Paul Rubin
Raymond Hettinger [EMAIL PROTECTED] writes: When writing a large suite, you quick come to appreciate being able to use assert statements with regular comparision operators, debugging with normal print statements, and not writing self.assertEqual over and over again. The generative tests are

Re: text analysis in python

2005-04-03 Thread Cameron Laird
In article [EMAIL PROTECTED], Maurice Ling [EMAIL PROTECTED] wrote: . . . In the Java world, there is GATE (general architecture for text engineering) and it seems very impressive. Are there something like that for Python?

Re: StopIteration in the if clause of a generator expression

2005-04-03 Thread Raymond Hettinger
[Peter Otten] Do you see any chance that list comprehensions will be redefined as an alternative spelling for list(generator expression)? Not likely. It is possible that the latter spelling would make it possible for Py3.0. eliminate list comps entirely. However, they are very popular and

Re: A ClientForm Question

2005-04-03 Thread Francesco
Il Fri, 01 Apr 2005 02:36:24 -0800, narke ha scritto: Does anyone here use ClientForm to handle a HTML form on client side? I got a form, within which there is a image control, it direct me to another page if i use mouse click on it. the code of the form as below: form

Re: unittest vs py.test?

2005-04-03 Thread Roy Smith
In article [EMAIL PROTECTED], Paul Rubin http://[EMAIL PROTECTED] wrote: Raymond Hettinger [EMAIL PROTECTED] writes: When writing a large suite, you quick come to appreciate being able to use assert statements with regular comparision operators, debugging with normal print statements, and

Newsgroup Programming

2005-04-03 Thread Chuck
I've found and used the nntplib module for newgroup programming. Can anyone suggest a library, technique or reference on how to combine mutliple messages with attachments such as mp3's, .wmv, *.avi, etc.? -- http://mail.python.org/mailman/listinfo/python-list

Re: text analysis in python

2005-04-03 Thread beliavsky
The book Text Processing in Python by David Mertz, available online at http://gnosis.cx/TPiP/ , may be helpful. -- http://mail.python.org/mailman/listinfo/python-list

Re: the bugs that try men's souls

2005-04-03 Thread Jordan Rastrick
I think I found your bug, although it took a bit of time, a fair bit of thought, and a fair bit of extra test-framework code - your program is very concise, reasonably complex, and very unreadable. Its perfect for testing maths theorems of your own interest, but you probably should have polished

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

2005-04-03 Thread Ron_Adam
On 3 Apr 2005 00:20:32 -0800, George Sakkis [EMAIL PROTECTED] wrote: Yes, it is possible to turn off type checking at runtime; just add this in the beginning of your define: def define(func): if not ENABLE_TYPECHECKING: return lambda func: func # else decorate func where

Re: text analysis in python

2005-04-03 Thread Maurice LING
. I don't know if you're aware that, in a fairly strong sense, anything [i]n the Java world *is* for Python. If you program with Jython (for example--there are other ways to achieve much the same end), your source code can be in Python, but you have full access to any library coded in Java.

Python Cookbook

2005-04-03 Thread Heiko Wundram
Hi all! I've received my copy of the Python Cookbook two days ago, and just thought that I might independently commend all you editors and recipe designers out there to an excellent book! I've thoroughly enjoyed reading the introductions in each chapter, and although I've been programming in

Re: string goes away

2005-04-03 Thread John J. Lee
Duncan Booth [EMAIL PROTECTED] writes: [...] str.join(sep, list_of_str) [...] Doesn't work with unicode, IIRC. John -- http://mail.python.org/mailman/listinfo/python-list

Re: string goes away

2005-04-03 Thread Martin v. Löwis
Andreas Beyer wrote: Yeeh, I was expecting something like that. The only reason to use map() at all is for improving the performance. That is lost when using list comprehensions (as far as I know). So, this is *no* option for larger jobs. Don't believe anything you hear right away, especially

Re: string goes away

2005-04-03 Thread Martin v. Löwis
Andreas Beyer wrote: If I am getting the docs etc. correctly, the string-module is depricated and is supposed to be removed with the release of Python 3.0. I still use the module a lot and there are situations in which I don't know what to do without it. Maybe you can give me some help. Out of

Re: string goes away

2005-04-03 Thread Paul Rubin
Martin v. Löwis [EMAIL PROTECTED] writes: Out of curiosity: when thinking about Python 3.0, what is the timespan in which you expect that to appear? Before 2010? After 2010? After 2020? I'm not terribly worried about Python 3.0 incompatibilities, whenever those are. There are already three

On slashdot

2005-04-03 Thread bearophileHUGS
There is a discussion about Python Moving into the Enterprise on Slashdot: http://it.slashdot.org/it/05/04/03/0715209.shtml?tid=156tid=8 Bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Cookbook

2005-04-03 Thread rdsteph
I want to just second this comment by Heike. I received my copy of the 2nd Edition from O'Reilly on Friday. I am still working my way slowly through the first chapter on Text, and I am nearing the end of that chapter. I intend to work my way through sequentially, because I can't think of a

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

2005-04-03 Thread Jeff Epler
if your goal is to search for files on a windows-style path environment variable, maybe you don't want to take this approach, but instead wrap and use the _wsearchenv or _searchenv C library functions http://msdn.microsoft.com/library/en-us/vclib/html/_crt__searchenv.2c_._wsearchenv.asp

re module non-greedy matches broken

2005-04-03 Thread lothar
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding ? after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. the regular expression module fails to perform non-greedy matches

Re: re module non-greedy matches broken

2005-04-03 Thread Andr Malo
* lothar wrote: re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding ? after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. the regular expression module fails

Re: Docorator Disected

2005-04-03 Thread Ron_Adam
On Sun, 03 Apr 2005 07:53:07 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: No, I did not know that you could pass multiple sets of arguments to That phraseology doesn't sound to me like your concept space is quite isomorphic with reality yet, sorry ;-) You'll be happy to know, my conceptual

Re: Docorator Disected

2005-04-03 Thread Ron_Adam
On 3 Apr 2005 00:11:22 -0800, El Pitonero [EMAIL PROTECTED] wrote: Martin v. Löwis wrote: Perhaps this will make you think a bit more: Now my problem is convincing the group I do know it. LOL Another example: def f(): return f g = f()()()()()()()()()()() is perfectly valid. Good

specialdict module

2005-04-03 Thread Georg Brandl
Hello, in follow-up to the recent dictionary accumulator thread, I wrote a little module with several subclassed dicts. Comments (e.g. makes it sense to use super), corrections, etc.? Is this PEP material? Docstrings, Documentation and test cases are to be provided later. mfg Georg

Re: specialdict module

2005-04-03 Thread Jeff Epler
The software you used to post this message wrapped some of the lines of code. For example: def __delitem__(self, key): super(keytransformdict, self).__delitem__(self, self._transformer(key)) In defaultdict, I wonder whether everything should be viewed as a factory: def

Re: text analysis in python

2005-04-03 Thread Mark Winrock
Maurice Ling wrote: Hi, I'm a postgraduate and my project deals with a fair bit of text analysis. I'm looking for some libraries and tools that is geared towards text analysis (and text engineering). So far, the most comprehensive toolkit in python for my purpose is NLTK (natural language tool

Re: Decorator Dissection

2005-04-03 Thread Ron_Adam
On Sun, 03 Apr 2005 08:32:09 +0200, Martin v. Löwis [EMAIL PROTECTED] wrote: Ron_Adam wrote: I wasn't aware that the form: result = function(args)(args) Was a legal python statement. So python has a built in mechanism for passing multiple argument sets to nested defined functions!

Re: specialdict module

2005-04-03 Thread Georg Brandl
Jeff Epler wrote: The software you used to post this message wrapped some of the lines of code. For example: def __delitem__(self, key): super(keytransformdict, self).__delitem__(self, self._transformer(key)) Somehow I feared that this would happen. In defaultdict, I wonder

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

2005-04-03 Thread Michael Spencer
chirayuk wrote: However, I just realized that the following is also a valid PATH in windows. PATH=c:\A\B;C\D;c:\program files\xyz (The quotes do not need to cover the entire path) Too bad! What a crazy format! So here is my handcrafted solution. def WinPathList_to_PyList (pathList): pIter =

Re: Queue.Queue-like class without the busy-wait

2005-04-03 Thread Nick Craig-Wood
Paul Rubin http wrote: Nick Craig-Wood [EMAIL PROTECTED] writes: I believe futex is the thing you want for a modern linux. Not very portable though. That's really cool, but I don't see how it can be a pure userspace operation if the futex has a timeout. The kernel must need to keep

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

2005-04-03 Thread George Sakkis
def define(func): if not ENABLE_TYPECHECKING: return lambda func: func # else decorate func A small correction: The argument of the decorator is not 'func' but the parameter checks you want to enforce. A template for define would be: def define(inputTypes, outputType): if not

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

2005-04-03 Thread Chirayu Krishnappa
My goal is to check for certain paths appearing in the current PATH (set by a bunch of scripts run in some random order) and (1) rearrange some of them so that they are in the correct order and (2) replace some for which I have preferred alternatives. The quote processing I saw cmd.exe do was

Re: specialdict module

2005-04-03 Thread Michael Spencer
Georg Brandl wrote: Hello, in follow-up to the recent dictionary accumulator thread, I wrote a little module with several subclassed dicts. Comments (e.g. makes it sense to use super), corrections, etc.? Is this PEP material? Docstrings, Documentation and test cases are to be provided later. mfg

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

2005-04-03 Thread Ron_Adam
On 3 Apr 2005 11:17:35 -0700, George Sakkis [EMAIL PROTECTED] wrote: def define(func): if not ENABLE_TYPECHECKING: return lambda func: func # else decorate func A small correction: The argument of the decorator is not 'func' but the parameter checks you want to enforce. A

help with python-devel!!!

2005-04-03 Thread gferreri
I am trying to install Numeric python which fails because I do not have /usr/lib/python-2.3/config/Makefile I've done some research and figured out I don't have the python-devel package ... how do I get this?? I'm running Mandrake 10.1 and typing urpmi python-devel does not work (it can't find

mini_httpd (ACME Labs) Python 2.4.1 integration

2005-04-03 Thread Venkat B
Hi folks,I have a webserver based on mini_httpd v1.19(http://www.acme.com/software/mini_httpd/).I'd like to run some python-based CGI scripts via this webserver on an RH9 system.In theory, with the right env settings, Ishould be able to launch mini_httpd like so: mini_httpd -c *.pyand be able to

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

2005-04-03 Thread Jeff Epler
The C code that Python uses to find the initial value of sys.path based on PYTHONPATH seems to be simple splitting on the equivalent of os.pathsep. See the source file Python/sysmodule.c, function makepathobject(). for (i = 0; ; i++) { p = strchr(path, delim); // ; on

Re: specialdict module

2005-04-03 Thread Georg Brandl
Michael Spencer wrote: 1. Given that these are specializations, why not have: class defaultvaluedict(dict): ... class defaultfactorydict(dict): ... rather than having to jump through hoops to make one implementation satisfy both cases I think I like Jeff's approach more

Help me dig my way out of nested scoping

2005-04-03 Thread Brendan
Hi everyone I'm new to Python, so forgive me if the solution to my question should have been obvious. I have a function, call it F(x), which asks for two other functions as arguments, say A(x) and B(x). A and B are most efficiently evaluated at once, since they share much of the same math, ie,

Re: specialdict module

2005-04-03 Thread Michael Spencer
Georg Brandl wrote: I think I like Jeff's approach more (defaultvalues are just special cases of default factories); there aren't many hoops required. Apart from that, the names just get longer ;) Yes Jeff's approach does simplify the implementation and more-or-less eliminates my complexity

Re: Docorator Disected

2005-04-03 Thread Martin v. Löwis
Ron_Adam wrote: This would be the same without the nesting: def foo(xx): global x x = xx return fee def fee(y): global x return y*x z = foo(2)(6) Actually, it wouldn't. def foo(xx): ... global x ... x = xx ... return fee ... def fee(y): ... global x ... return y*x

Re: text analysis in python

2005-04-03 Thread Maurice LING
Mark Winrock wrote: You might try http://web.media.mit.edu/~hugo/montylingua/ Liu, Hugo (2004). MontyLingua: An end-to-end natural language processor with common sense. Available at: web.media.mit.edu/~hugo/montylingua. Thanks Mark. I've downloaded MontyLingua and it looks pretty cool. To me,

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Michael Spencer
Brendan wrote: Hi everyone I'm new to Python, so forgive me if the solution to my question should have been obvious. ... Good question. For a thorough explanation see: http://www.python.org/dev/doc/devel/ref/naming.html Simple version follows: OK, here's my problem: How do I best store and

Re: StopIteration in the if clause of a generator expression

2005-04-03 Thread Steven Bethard
Raymond Hettinger wrote: [Peter Otten] Do you see any chance that list comprehensions will be redefined as an alternative spelling for list(generator expression)? Not likely. It is possible that the latter spelling would make it possible for Py3.0. eliminate list comps entirely. However, they

Re: text analysis in python

2005-04-03 Thread Terry Reedy
Maurice LING [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Say I code my stuffs in Jython (importing java libraries) in a file text.py Just to be clear, Jython is not a separate langague that you code *in*, but a separate implementation that you may slightly differently code

Re: threading.Event file descriptor

2005-04-03 Thread elbertlev
Nicolas Fleury wrote: Hi, Is there any way to get the file descriptor on Unix or handle on Windows associated internally with a threading.Event object? So that it can be used in a call to select or WaitForMultipleObjects. Thx and regards, Nicolas Good idea! But... There is no event

Re: Help me dig my way out of nested scoping

2005-04-03 Thread James Stroud
I wish I had time to dig into your specific problem because it looks interesting. But I think you might want to look at python generators. I beleive there is no reason that they can't yield a function. http://www.python.org/peps/pep-0255.html http://docs.python.org/ref/yield.html

Re: threading.Event file descriptor

2005-04-03 Thread Nicolas Fleury
[EMAIL PROTECTED] wrote: There is no event handle used in Event object (for NT at least). Do not know about Linux... And there's no handle at all? It's not important if it's not an event handle as long as it is an handle usable with WaitForMultipleObjects. Also, I don't understand how it will

Re: StopIteration in the if clause of a generator expression

2005-04-03 Thread [EMAIL PROTECTED]
This is all just making everything far too complicated. What you really want to do is quite simple: import itertools def condition(x): return x 5 list(itertools.takewhile(condition, (i for i in range(10 The 'Stop Iteration In Generator Expression' problem was solved in the language that

Question about the Python Cookbook: How much of this is new?

2005-04-03 Thread RickMuller
I had a question about the second edition of the Python Cookbook. I own and have thoroughly enjoyed the first edition of the Python Cookbook. How much of the second edition is new? Is this essential reading if I already have the first edition? I realize that there are new sections that describe

Re: unittest vs py.test?

2005-04-03 Thread Terry Reedy
Paul Rubin http://phr.cx@NOSPAM.invalid wrote in message news:[EMAIL PROTECTED] Raymond Hettinger [EMAIL PROTECTED] writes: When writing a large suite, you quick come to appreciate being able to use assert statements with regular comparision operators, debugging with normal print statements,

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

2005-04-03 Thread Sunnan
Scott David Daniels wrote: No, poetry is to be read slowly and carefully, appreciating the nuance at every point. You should be able to read past python, while poetry is at least as much about the form of the expression as it is about what is being expressed. Right, I agree with these

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

2005-04-03 Thread Sunnan
Aahz wrote: Note very, VERY, *VERY* carefully that the quote says nothing about boring code. The quote explicitly refers to reams of trivial code as boring -- and that's quite true. Consider this distinction: Thank you for this important clarification. if foo == 'red': print 'foo is

Re: Lambda: the Ultimate Design Flaw

2005-04-03 Thread Sunnan
Artie Gold wrote: Torsten Bronger wrote: The whole text seems to be a variant of http://www.artima.com/weblogs/viewpost.jsp?thread=98196. Tsch, Torsten. Ya think? ;-) Heh. I was glad that Torsten pointed it out; I didn't get what was funny about the joke until then. --

Re: Question about the Python Cookbook: How much of this is new?

2005-04-03 Thread Robert Kern
RickMuller wrote: I had a question about the second edition of the Python Cookbook. I own and have thoroughly enjoyed the first edition of the Python Cookbook. How much of the second edition is new? Is this essential reading if I already have the first edition? I realize that there are new

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Terry Hancock
On Sunday 03 April 2005 04:12 pm, Brendan wrote: from ThirdPartyLibrary import F from MyOtherModule import AB def FW(x): lastX = None aLastX = None bLastX = None I'm pretty sure your method will work if you just specify that these are global: def FW(x): global lastX =

Re: string goes away

2005-04-03 Thread Dan Bishop
John J. Lee wrote: Duncan Booth [EMAIL PROTECTED] writes: [...] str.join(sep, list_of_str) [...] Doesn't work with unicode, IIRC. u .join([What's, the, problem?]) uWhat's the problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Ron_Adam
On 3 Apr 2005 14:12:48 -0700, Brendan [EMAIL PROTECTED] wrote: Hi everyone I'm new to Python, so forgive me if the solution to my question should have been obvious. I have a function, call it F(x), which asks for two other functions as arguments, say A(x) and B(x). A and B are most efficiently

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Terry Reedy
Brendan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a function, call it F(x), which asks for two other functions as arguments, say A(x) and B(x). ... If I understand this and the rest, a third party library whose code you cannot modify (easily) has a function F with (at

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Brendan
Thanks for the tips. Making FW a callable class (choice 5) seems to be a good (if verbose) solution. I might just wrap my temporary values in a list [lastX, lastA, lastB] and mutate them as Michael suggests. Thanks to Michael especially for the explanation of the name-binding process that's at

Re: text analysis in python

2005-04-03 Thread Maurice LING
Terry Reedy wrote: Maurice LING [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Say I code my stuffs in Jython (importing java libraries) in a file text.py Just to be clear, Jython is not a separate langague that you code *in*, but a separate implementation that you may slightly

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Brendan
F -is- in fact an iterative optimizer that minimizes A on x (B is the derivative of A). So yes, F will call A and B on mulitple 'x's. In that case, it seems the mutable object trick is the way to go. Thanks. I didn't follow your last sentence. What about the Python Cookbook? --

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Brendan
James Stroud Apr 3, 3:18 pm: I think you might want to look at python generators. I've seen discussion of generators before, but haven't invested the time to understand them yet. This might be a good excuse. -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest vs py.test?

2005-04-03 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: But assert statements vanish when you turn on the optimizer. If you're going to run your application with the optimizer turned on, I certainly hope you run your regression tests with the optimizer on. I don't see why you think so. Assertion

Re: threading.Event file descriptor

2005-04-03 Thread Nicolas Fleury
[EMAIL PROTECTED] wrote: //And there's no handle at all? There is one (check thread_nt.h) you have to propagate HANDLE to Pythom level. That's why, you have to change the interpreter. Do not forget, that thread is a build-in module. Sounds fine with me. A fileno (or whatever) function can be

Re: threading.Event file descriptor

2005-04-03 Thread elbertlev
//And there's no handle at all? There is one (check thread_nt.h) you have to propagate HANDLE to Pythom level. That's why, you have to change the interpreter. Do not forget, that thread is a build-in module. //I wouldn't want to derive from Event since my goal would be to submit a patch to make

Re: unittest vs py.test?

2005-04-03 Thread Roy Smith
Scott David Daniels [EMAIL PROTECTED] wrote: Any code depending upon __debug__ being 0 won't be tested. Sometimes test structures update values as a side-effect of tracking the debugging state. Not massively likely, but it makes for a scary environment when your tests cannot be run on a

Re: unittest vs py.test?

2005-04-03 Thread Scott David Daniels
Paul Rubin wrote: Terry Reedy [EMAIL PROTECTED] writes: But assert statements vanish when you turn on the optimizer. If you're going to run your application with the optimizer turned on, I certainly hope you run your regression tests with the optimizer on. I don't see why you think so. Assertion

Re: re module non-greedy matches broken

2005-04-03 Thread lothar
this response is nothing but a description of the behavior i reported. as to whether this behaviour was intended, one would have to ask the module writer about that. because of the statement in the documentation, which places no qualification on how the scan for the shortest possible match is to

Re: SimpleRPCServer

2005-04-03 Thread robin
Skip Montanaro [EMAIL PROTECTED] wrote: First, from my reading of SimpleXMLRPCServer, I don't think _dispatch() belongs at that level. It belongs in the request handler class or in a separate dispatcher class, depending on what version of Python you're using. Quite so. As a variant I just use

Re: Docorator Disected

2005-04-03 Thread Ron_Adam
On Sun, 03 Apr 2005 23:59:51 +0200, Martin v. Löwis [EMAIL PROTECTED] wrote: Ron_Adam wrote: This would be the same without the nesting: def foo(xx): global x x = xx return fee def fee(y): global x return y*x z = foo(2)(6) Actually, it wouldn't. Ok, yes,

Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Tom Eastman
I'm not new to Python, but I didn't realise that sys.stdin could be called as an iterator, very cool! However, when I use the following idiom: for line in sys.stdin: doSomethingWith(line) and then type stuff into the program interactively, nothing actually happens until I hit CTRL-D.

Re: Making a DLL with python?

2005-04-03 Thread Greg Ewing
[EMAIL PROTECTED] wrote: I'd love to do the whole thing in Python, but I don't know how to make a DLL purely from Python. I don't think you can do it *purely* in Python. You'll at least need a C or Pyrex wrapper which dispatches to Python code. -- Greg Ewing, Computer Science Dept, University of

Re: property and virtuality

2005-04-03 Thread Greg Ewing
Laszlo Zsolt Nagy wrote: My problem is about properties and the virtuality of the methods. I would like to create a property whose get and set methods are virtual. You might find the following function useful, which I developed for use in PyGUI. def overridable_property(name, doc = None):

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread David Trudgett
I'm not a Python expert by any means, but you're describing the classic symptoms of buffering. There is a '-u' command line switch for python to turn off buffering but that does not affect file iterators. See http://www.hmug.org/man/1/python.html for instance. Tom Eastman [EMAIL PROTECTED]

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Jeff Epler
The iterator for files is a little bit like this generator function: def lines(f): while 1: chunk = f.readlines(sizehint) for line in chunk: yield line Inside file.readlines, the read from the tty will block until sizehint bytes have been read or EOF is seen.

Re: Help me dig my way out of nested scoping

2005-04-03 Thread Ron_Adam
On 3 Apr 2005 16:21:10 -0700, Brendan [EMAIL PROTECTED] wrote: Thanks for the tips. Making FW a callable class (choice 5) seems to be a good (if verbose) solution. I might just wrap my temporary values in a list [lastX, lastA, lastB] and mutate them as Michael suggests. Thanks to Michael

Re: string goes away

2005-04-03 Thread Greg Ewing
Dan Bishop wrote: John J. Lee wrote: Doesn't work with unicode, IIRC. u .join([What's, the, problem?]) uWhat's the problem? str.join(x, y) isn't quite a drop-in replacement for string.join(y, x), since it's not polymorphic on the joining string: str.join(u , [a, b]) Traceback (most recent call

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Steven Bethard
Jeff Epler wrote: The iterator for files is a little bit like this generator function: def lines(f): while 1: chunk = f.readlines(sizehint) for line in chunk: yield line Inside file.readlines, the read from the tty will block until sizehint bytes have been read

Re: what's the use of __repr__?when shall I use it?

2005-04-03 Thread Greg Ewing
Vikram wrote: __repr__ should return something that when eval'ed yields an identical object (if possible). That's strictly possible in so few cases that it's not really a very helpful guideline, in my opinion. I find the following view more helpful: * str() is for producing the normal output of a

Re: On slashdot

2005-04-03 Thread Isle Of The Dead
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] There is a discussion about Python Moving into the Enterprise on Slashdot: http://it.slashdot.org/it/05/04/03/0715209.shtml?tid=156tid=8 Using dejanews as a proxy to measure the meme propagation of python versus other scripting

checkbook manager

2005-04-03 Thread David Isaac
I'd like to try personal financial management using Python. I just found PyCheckbook, but it does not support check printing. Is there a Python check printing application kicking around? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: help with python-devel!!!

2005-04-03 Thread Michele Simionato
Just give (as root) # urpmi python-devel (assuming you have configured urpmi properly, Google for easy urpmi). Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: (win32) speedfan api control

2005-04-03 Thread Cappy2112
Nice idea- getting the handle to a control. But how do you know what to pass for wparam , lparam , flags ? BTW- I don't see anything unique to Active Python here. You can do all of this with the Python windows extensions, which can be installed without Active Python. --

[ python-Feature Requests-1175686 ] add reload function

2005-04-03 Thread SourceForge.net
Feature Requests item #1175686, was opened at 2005-04-03 08:48 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1175686group_id=5470 Category: IDLE Group: None Status: Open

[ python-Bugs-1175848 ] poorly named variable in urllib2.py

2005-04-03 Thread SourceForge.net
Bugs item #1175848, was opened at 2005-04-03 11:26 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1175848group_id=5470 Category: Python Library Group: Python 2.3 Status: Open

[ python-Bugs-1175202 ] python hangs if import statement launches threads

2005-04-03 Thread SourceForge.net
Bugs item #1175202, was opened at 2005-04-02 07:24 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1175202group_id=5470 Category: Threads Group: Python 2.4 Status: Closed Resolution: Wont Fix

[ python-Feature Requests-1155485 ] file() on a file

2005-04-03 Thread SourceForge.net
Feature Requests item #1155485, was opened at 2005-03-03 00:48 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1155485group_id=5470 Category: Python Interpreter Core Group: None Status: Closed

[ python-Bugs-1175967 ] StringIO and cStringIO don't provide 'name' attribute

2005-04-03 Thread SourceForge.net
Bugs item #1175967, was opened at 2005-04-03 15:20 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1175967group_id=5470 Category: None Group: None Status: Open Resolution: None

  1   2   >