Re: MD5 module Pythonicity

2005-10-14 Thread Fredrik Lundh
Fredrik Lundh wrote: > Forcing every digest module to add code to cater for just one of many > use cases is most likely a waste of time. here's the hash API specification, btw: http://www.python.org/peps/pep-0247.html -- http://mail.python.org/mailman/listinfo/python-list

Re: MD5 module Pythonicity

2005-10-14 Thread Fredrik Lundh
Leandro Lameiro wrote: > What's wrong in having a function like the one I said, that would > split files for you, feed md5.update and, when it is over, return the > digest? Calculating the digest sum for a file on disk, without doing anything else with that file, is a very small subset of everyth

Re: MD5 module Pythonicity

2005-10-14 Thread Mike Meyer
Leandro Lameiro <[EMAIL PROTECTED]> writes: > What's wrong in having a function like the one I said, that would > split files for you, feed md5.update and, when it is over, return the > digest? Nothing in particular; it's just a trivial thing to write. If you add every usefull utility function to

Re: Microsoft Hatred FAQ

2005-10-14 Thread Peter T. Breuer
In comp.os.linux.misc Jeroen Wenting wrote: > Without Microsoft 90% of us would never have seen a computer more powerful > than a ZX-81 and 90% of the rest of us would never have used only dumb > mainframe terminals. Uh - when microsoft produced dos 1.0, or whatever it was, I was sitting at my

Re: Microsoft Hatred FAQ

2005-10-14 Thread Jim Moe
Xah Lee wrote: > > Question: U.S. Judges are not morons, and quite a few others are > not morons. They find MS guilty, so it must be true. > > Answer: so did the German population thought Jews are morons by > heritage, to the point that Jews should be exterminated from earth. > Apparently, th

Re: Problem splitting a string

2005-10-14 Thread Mike Meyer
Robert Kern <[EMAIL PROTECTED]> writes: > Anthony Liu wrote: >> I have this simple string: >> >> mystr = 'this_NP is_VL funny_JJ' >> >> I want to split it and give me a list as >> >> ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] > You could use regular expressions as Jason Stitt mentions, or you cou

Re: Can module access global from __main__?

2005-10-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Neal Norwitz" <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Neal Becker wrote: > > > > > > Still curious about the answer. If I know that I am imported from > > > __main__, > > > then I can do access X as sys.modules[__main__].X. In general, I don't > >

Re: Microsoft Hatred FAQ

2005-10-14 Thread Jeroen Wenting
>> >>Q: Microsoft's Operating System is used over 90% of PCs. If that's >>not monopoly, i don't know what is. > > They got where they are by CHEATING. That is why they are evil, not > because they have a large market share. no, they got their by clever marketing and generally having a produ

Re: Straight line detection

2005-10-14 Thread Nigel Rowe
Tim Roberts wrote: > "PyPK" <[EMAIL PROTECTED]> wrote: >> >>Does anyone know of a simple implementation of a straight line >>detection algorithm something like hough or anything simpler.So >>something like if we have a 2D arary of pixel elements representing a >>particular Image. How can we identi

MD5 module Pythonicity

2005-10-14 Thread Leandro Lameiro
Hi folks Recently I have been discussing with a friend about python ease of use, and it is really good at this. This friend needed to calculate the MD5 hash of some files and was telling me about the MD5 module. The way he told me and how it is described in the Python Docs, the method to calculate

Re: how to make this code faster

2005-10-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > def f(x,y): > return math.sin(x*y) + 8 * x > I have code like this: > > def main(): > n = 2000 > a = zeros((n,n), Float) > xcoor = arange(0,1,1/float(n)) > ycoor = arange(0,1,1/float(n)) > > >

Re: PyGame & Web hosts

2005-10-14 Thread Terry Hancock
On Friday 14 October 2005 11:04 pm, boyanpn wrote: > I wonder if my web host suports python (with pygame), if I download > game from www.pygame.org and upload it to my site, could users access > to it with browser and play game ? In the main, no. PyGame is a multimedia library, using SDL to acces

Re: Problem splitting a string

2005-10-14 Thread Robert Kern
Anthony Liu wrote: > I have this simple string: > > mystr = 'this_NP is_VL funny_JJ' > > I want to split it and give me a list as > > ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] > I think the documentation does say that the > separator/delimiter can be a string representing all > delimiters we wa

Re: Problem splitting a string

2005-10-14 Thread Erik Max Francis
Anthony Liu wrote: > I have this simple string: > > mystr = 'this_NP is_VL funny_JJ' > > I want to split it and give me a list as > > ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] > > 1. I tried mystr.split('_| '), but this gave me: > > ['this_NP is_VL funny_JJ'] > > It is not splitted at all.

Re: C Wrapper Function, crashing Python?

2005-10-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Java and Swing" <[EMAIL PROTECTED]> wrote: > one more update... > > if I remove PyMem_Free and free(...) ...so no memory clean up...I can > still only call doStuff 4 times, the 5th attemp crashes Python. > > Java and Swing wrote: > > update: > > if I use C's fre

Re: Problem splitting a string

2005-10-14 Thread Jason Stitt
On Oct 14, 2005, at 11:52 PM, Anthony Liu wrote:I have this simple string:mystr = 'this_NP is_VL funny_JJ'I want to split it and give me a list as['this', 'NP', 'is', 'VL', 'funny', 'JJ']1. I tried mystr.split('_| '), but this gave me:['this_NP is_VL funny_JJ']Try re.split, as in:import rere.split(

Problem splitting a string

2005-10-14 Thread Anthony Liu
I have this simple string: mystr = 'this_NP is_VL funny_JJ' I want to split it and give me a list as ['this', 'NP', 'is', 'VL', 'funny', 'JJ'] 1. I tried mystr.split('_| '), but this gave me: ['this_NP is_VL funny_JJ'] It is not splitted at all. 2. I tried mystr.split('_'), and this gave me:

Re: Comparing lists

2005-10-14 Thread Christian Stapfer
"jon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > To take the heat out of the discussion: > > sets are blazingly fast. I'd prefer a (however) rough characterization of computational complexity in terms of Big-Oh (or Big-whatever) *anytime* to marketing-type characterizations l

PyGame & Web hosts

2005-10-14 Thread boyanpn
I a newbie in python so excuse me if my question sounds stupid or something :( I wonder if my web host suports python (with pygame), if I download game from www.pygame.org and upload it to my site, could users access to it with browser and play game ? -- http://mail.python.org/mailman/listinfo/p

Re: Microsoft Hatred FAQ

2005-10-14 Thread Tim Hammerquist
["Followup-To:" header set to comp.lang.perl.misc.] Roedy Green <[EMAIL PROTECTED]> wrote: > "Xah Lee" <[EMAIL PROTECTED]> wrote or quoted : > > Q: Microsoft's Operating System is used over 90% of PCs. > > If that's not monopoly, i don't know what is. > > They got where they are by CHEATING. Th

Re: Reading IEEE 754 format strings directly into a floating point array

2005-10-14 Thread Ben Caradoc-Davies
Madhusudan Singh wrote: > The values are returned as IEEE format binary floating point numbers. There > are 4 bytes per point. Multiple points are not separated by any delimiter. > Is it possible to read these directly into a floating point array of the > size of the string ? Consider using the st

Re: Microsoft Hatred FAQ

2005-10-14 Thread Keith Thompson
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hm... What does this have to do with Perl? > > Why did you post this in comp.lang.perl.misc? He posted this in comp.lang.python, comp.lang.perl.misc, comp.unix.programmer, comp.lang.java.programmer, *and* comp.os.linux.misc because he's a troll. I

Re: output

2005-10-14 Thread Steven D'Aprano
On Fri, 14 Oct 2005 17:48:59 -0700, Shi Mu wrote: > After I run the following python code, I expect to have the printing such as: > The year is 2005 > > However, I got something like: > The year is 2005 > Fri Oct 14 17:43:31 2005 > Fri Oct 14 17:43:31 2005 > The year is 2005 > > What is the reas

Re: deleting a parameter's name as it is passed to a function

2005-10-14 Thread Paul Rubin
"Amir Michail" <[EMAIL PROTECTED]> writes: > But dosomestuff can get rid of its reference before it returns (perhaps > it has a lot more to do before it returns and so you would want to > garbage collect the parameter object as soon as possible). That would be so rare and weird that your best bet

Re: Reading IEEE 754 format strings directly into a floating point array

2005-10-14 Thread Robert Kern
Madhusudan Singh wrote: > I am querying an instrument in a measurement application. > > The values are returned as IEEE format binary floating point numbers. There > are 4 bytes per point. Multiple points are not separated by any delimiter. > > Is it possible to read these directly into a floatin

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-14 Thread Bengt Richter
On Wed, 12 Oct 2005 02:15:40 -0400, Chris Smith <[EMAIL PROTECTED]> wrote: >> "Sebastian" == Sebastian Bassi <[EMAIL PROTECTED]> writes: > >Sebastian> On 9/30/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >>> after Guido's pronouncement yesterday, in one of the next >>> versio

SAFE CYBER SEX LESSONS

2005-10-14 Thread Sk8xHAnDiCApx69
hi there imhappily married and me and my wife are looking to cyber -- http://mail.python.org/mailman/listinfo/python-list

Reading IEEE 754 format strings directly into a floating point array

2005-10-14 Thread Madhusudan Singh
I am querying an instrument in a measurement application. The values are returned as IEEE format binary floating point numbers. There are 4 bytes per point. Multiple points are not separated by any delimiter. Is it possible to read these directly into a floating point array of the size of the str

Re: deleting a parameter's name as it is passed to a function

2005-10-14 Thread Steven D'Aprano
On Fri, 14 Oct 2005 17:40:48 -0700, Amir Michail wrote: > Hi, > > I think it would be useful to delete a name of a parameter object as > the object is passed to a function: > > dosomestuff(del a) That's a horrible syntax. It would require Python to be completely re-designed to allow statements

Re: Help with creating a dict from list and range

2005-10-14 Thread George Sakkis
"James Stroud" <[EMAIL PROTECTED]> wrote: > Could be even simpler since enumerate creates tuples anyway: > > dct = dict(x for x in enumerate(description)) > > James > > On Friday 14 October 2005 08:37, Steve Holden wrote: > > >>> dct = dict((x[1], x[0]) for x in enumerate(description)) > > >>> d

Accessing Parallel Port in Python Error : Priviledged Instruction

2005-10-14 Thread [EMAIL PROTECTED]
Hello When I use Pyparallel to access the parallel port in WinXP with Python I get an error saying that this is a priviledged instruction Any clue ? Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: wierd threading behavior

2005-10-14 Thread Neil Hodgson
Qun Cao: > import thread > def main(): > thread.start_new(test.()) > > def test(): > print 'hello' > > main() > " > this program doesn't print out 'hello' as it is supposed to do. > while if I change main() The program has exited before the thread has managed to run. It is undefine

Re: XML dom question

2005-10-14 Thread George Sakkis
"George" <[EMAIL PROTECTED]> wrote: > How can I do the following in python: > > [snipped] In exactly the same way you could do it if you actually read the replies to the thread with the same topic you posted yesterday. Duh! George -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-14 Thread [EMAIL PROTECTED]
Hm... What does this have to do with Perl? Why did you post this in comp.lang.perl.misc? -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-14 Thread Roedy Green
On 14 Oct 2005 19:01:42 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote or quoted : > >Q: Microsoft's Operating System is used over 90% of PCs. If that's >not monopoly, i don't know what is. They got where they are by CHEATING. That is why they are evil, not because they have a large market shar

Re: Class property

2005-10-14 Thread Bengt Richter
On Thu, 06 Oct 2005 16:09:22 +0200, Laszlo Zsolt Nagy <[EMAIL PROTECTED]> wrote: >Peter Otten wrote: > >>Laszlo Zsolt Nagy wrote: >> >> >> >>>I was trying for a while, but I could not implement a 'classproperty' >>>function. Is it possible at all? >>> >>> >> >>You could define a "normal" pro

Re: win32api.FindFiles Win2003, problem with Short Name

2005-10-14 Thread Neil Hodgson
Frank Borell: > On all three types of PC/Servers they are set to 0. > > For now I'll have to process this script on non 2003 servers?!? What do you get if you call win32api.GetShortPathName on the long name? Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: Class property (was: Class methods)

2005-10-14 Thread Bengt Richter
On Thu, 06 Oct 2005 11:05:10 +0200, Laszlo Zsolt Nagy <[EMAIL PROTECTED]> wrote: >Hughes, Chad O wrote: > >> Is there any way to create a class method? I can create a class >> variable like this: >> >Hmm, seeing this post, I have decided to implement a 'classproperty' >descriptor. >But I could

Re: Help with creating a dict from list and range

2005-10-14 Thread James Stroud
Could be even simpler since enumerate creates tuples anyway: dct = dict(x for x in enumerate(description)) James On Friday 14 October 2005 08:37, Steve Holden wrote: > >>> dct = dict((x[1], x[0]) for x in enumerate(description)) > >>> dct > > {'second': 1, 'third': 2, 'first': 0} > > regards >

Microsoft Hatred FAQ

2005-10-14 Thread Xah Lee
Microsoft Hatred, FAQ Xah Lee, 20020518 Question: U.S. Judges are not morons, and quite a few others are not morons. They find MS guilty, so it must be true. Answer: so did the German population thought Jews are morons by heritage, to the point that Jews should be exterminated from earth. Ap

Re: Numeric array equivalent of index ?

2005-10-14 Thread Robert Kern
Nicolas Pernetty wrote: > Hello, > > I'm trying to find a clear and fast equivalent to the index method of > plain python list : > >>>a = [5,1,4,3,4] >>>a.index(4) > > 2 > > I have to use it on a Numeric array, so the best I've come up with is > (rather ugly I think) : > >>>from Numeric import

XML dom question

2005-10-14 Thread George
How can I do the following in python: compare the text in the element tags with the elements tags in filling and if they match replace the text within the elements tags with the text in the matching element tag of fillin. For example Since the text Monday in form matches the Element tag in fill

Capturing audio from a microphone on Mac OS X

2005-10-14 Thread Michael
Hi, This might seem a dumb question, but every search I've done so far has come up blank - with the possible exception of Schtoom. I've seen Schtoom that does manage to capture audio under Mac OS X, but it's unclear whether the audio tools it uses can be used independently of Schtoom. So my ques

Re: deleting a parameter's name as it is passed to a function

2005-10-14 Thread Amir Michail
Paul Rubin wrote: > "Amir Michail" <[EMAIL PROTECTED]> writes: > > The idea is to garbage collect the object as soon as possible, and this > > may be sooner than when dosomestuff returns. > > If it's a parameter to dosomestuff, then there's still a reference > until dosomestuff returns. Simply ge

Re: deleting a parameter's name as it is passed to a function

2005-10-14 Thread Paul Rubin
"Amir Michail" <[EMAIL PROTECTED]> writes: > The idea is to garbage collect the object as soon as possible, and this > may be sooner than when dosomestuff returns. If it's a parameter to dosomestuff, then there's still a reference until dosomestuff returns. Simply getting rid of the name only fr

output

2005-10-14 Thread Shi Mu
After I run the following python code, I expect to have the printing such as: The year is 2005 However, I got something like: The year is 2005 Fri Oct 14 17:43:31 2005 Fri Oct 14 17:43:31 2005 The year is 2005 What is the reason? The code follows: import time import now class today(now.now):

Numeric array equivalent of index ?

2005-10-14 Thread Nicolas Pernetty
Hello, I'm trying to find a clear and fast equivalent to the index method of plain python list : >> a = [5,1,4,3,4] >> a.index(4) 2 I have to use it on a Numeric array, so the best I've come up with is (rather ugly I think) : >> from Numeric import array, equal, nonzero >> a = array([5,1,4,3,4])

deleting a parameter's name as it is passed to a function

2005-10-14 Thread Amir Michail
Hi, I think it would be useful to delete a name of a parameter object as the object is passed to a function: dosomestuff(del a) instead of dosomestuff(a) del a The idea is to garbage collect the object as soon as possible, and this may be sooner than when dosomestuff returns. Amir -- http:/

Re: wierd threading behavior

2005-10-14 Thread Shitiz Bansal
seems that in the thread module, the stdout stream is captured by a single thread. Qun Cao <[EMAIL PROTECTED]> wrote: Thanks Sam,That was a stupid typo ( yeah, I actually typed it in :), it should be(test,()).I am using python 2.4.1 in ubuntu. I do aware that threading.Thread isprefered,but I did n

machine-independant bench

2005-10-14 Thread Tarek Ziadé
Hi list, I am trying to code some utilities to bench code performances, machine-independant, to be able to measure the absolute cost of a piece of code. So i came up with the pystone idea (i've been told too in fact ;)). so I just run pystones on the test machines and use it as a ratio over co

Re: How to get a raised exception from other thread

2005-10-14 Thread Shitiz Bansal
Threads can share the same memory space. Hence a very neat way to achieve the objective.   > For example:> > ---> programA.py> ---> > import programB Exception=0; > thread = programB.MakeThread()> thread.start() if (Exception):   raise SomeException() > ---

Re: updating local()

2005-10-14 Thread Bengt Richter
On Thu, 06 Oct 2005 07:15:12 -0700, Robert Kern <[EMAIL PROTECTED]> wrote: >Flavio wrote: >> Ok, its not thousands, but more like dozens of variables... >> I am reading a large form from the web which returns a lot of values. >> (I am Using cherrypy) >> >> I know I could pass these variables arou

Re: wierd threading behavior

2005-10-14 Thread Qun Cao
Thanks Sam, That was a stupid typo ( yeah, I actually typed it in :), it should be (test,()). I am using python 2.4.1 in ubuntu. I do aware that threading.Thread is prefered, but I did not realize thread is deprecated. It is still a mysterious behavior anyhow. :) -- http://mail.python.org/mailm

Re: wierd threading behavior

2005-10-14 Thread Sam Pointon
thread is a low-level threading module, and start_new is deprecated. Aside from that, thread.start_new(test.()) is syntaxically wrong (a pair of brackets can't follow a dot). However, your example does work for me once I fix the syntax, and it prints hello but then hangs. I can't explain the other

Re: UI toolkits for Python

2005-10-14 Thread Claudio Grondi
"Kenneth McDonald" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED] > Thanks for reminding me of Gtk. OK, add that to the list. > > The Web Browser interface is good for simple things, and will get better > with CSS2's adoption, but they still don't have a good way for important > things like i

Re: threading/forking and IPC

2005-10-14 Thread Qun Cao
Thanks David, This seems like the exact thing I am looking for! -- http://mail.python.org/mailman/listinfo/python-list

wierd threading behavior

2005-10-14 Thread Qun Cao
Hello, I am just starting to play threading in python, here is a really interesting problem I am very curious about: " import thread def main(): thread.start_new(test.()) def test(): print 'hello' main() " this program doesn't print out 'hello' as it is supposed to do. while if I change

Re: Best way to handle cgi sessions

2005-10-14 Thread Christoph Haas
On Friday 14 October 2005 21:22, Derek Perriero wrote: > What would be the best way to create a cgi session that contains the > basic elements of a cookie and can also hold secure data, such as a > username/password. [...] Said. Done. I just tidied up a module we will be using for a web site here.

Re: object inheritance and default values

2005-10-14 Thread Ron Adam
George Sakkis wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote: > > >>I'm trying to implement simple svg style colored complex objects in >>tkinter and want to be able to inherit default values from other >>previously defined objects. >> >>I want to something roughly similar to ... >> >>class sh

Re: How to get a raised exception from other thread

2005-10-14 Thread Jeremy Moles
On non-Windows system there are a ton of ways to do it--this is almost a whole field unto itself. :) (D-BUS, fifos, sockets, shmfs, etc.) In Windows, I wouldn't have a clue. I guess this is a hard question to answer without a bit more information. :) On Fri, 2005-10-14 at 14:45 -0700, dcrespo wr

Re: Function to execute only once

2005-10-14 Thread George Sakkis
"snoe" <[EMAIL PROTECTED]> wrote: > I've been seeing alot about decorators and closures lately and my > initial thought was that this would be a good place to use them instead > of wrapping it around a class. That was my initial thought :) What I > came up with was this: Apparently you're not the

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-14 Thread Fernando Perez
> Kenneth McDonald a écrit : >> For unfortunate reasons, I'm considering switching back to Win XP (from >> OS X) as my "main" system. Windows has so many annoyances that I can >> only compare it to driving in the Bay Area at rush hour (OS X is like >> driving in Portland at rush hour--not as bad

Re: confusion between global names and instantiated object variable names

2005-10-14 Thread Alex Martelli
wanwan <[EMAIL PROTECTED]> wrote: ... > when I run my example, an error shows: > "NameError: global name'menubar' is not defined" > > I wonder why it doesn't work. Isn't that the way to define an object > variable? The code you posted should not trigger this error. Most likely problem: you

How to get a raised exception from other thread

2005-10-14 Thread dcrespo
Hi all, How can I get a raised exception from other thread that is in an imported module? For example: --- programA.py --- import programB thread = programB.MakeThread() thread.start() --- programB.py --- import threading, time class SomeExcept

Re: array subset could be improved? -repost ;)

2005-10-14 Thread Fernando Perez
Jim O'D wrote: > Hi all > > I have an array a=array([2,3,-1]). > > I want to extract an array with all the elements of a that are less than 0. Numeric is currently changing into the new scipy core. If you are willing to play with beta code, get it here: http://numeric.scipy.org if not, wait

Re: confusion between global names and instantiated object variable names

2005-10-14 Thread wanwan
oops, of course. Very careless mistake. thx -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-14 Thread Kenneth McDonald
Um, sorry, but this isn't correct.Although there might be a slight bit of gray area, the simple difference between compiled and interpreted languages is that compiled languages produce a binary consisting of bytes that mean something specific to the CPU of the computer the program is running on. Th

A way to set levels of access to users

2005-10-14 Thread dcrespo
Hi all, I have this table on a database: Table: user coduser | username | password | securitylevel 1| fcumana || 0123456789qwe where "securitylevel" is a string where the presence of each character is a permited key for running certain functions. For example: functions.py

Re: threading/forking and IPC

2005-10-14 Thread David Wahler
Sophia Cao wrote: > Hello, > > I am seeking a python solution for my project. I am trying to > implement an architecture where there is a server who receives incoming > messages from several clients, then those messages need to be written > to a MySQL database. To avoid too many connections to t

Re: confusion between global names and instantiated object variable names

2005-10-14 Thread Piet van Oostrum
> "wanwan" <[EMAIL PROTECTED]> (w) wrote: >w> I'm trying to make a GUI, but for some of the instantiated object >w> variable names, the interpreter is looking at them as global names. >w> Here is an example of what I did: >w> class mygui: >w> def __init__(self, root): >w>

Re: Function to execute only once

2005-10-14 Thread Paul Rubin
"snoe" <[EMAIL PROTECTED]> writes: > Also why is it if I set tmp as a global and don't pass it as a > paremeter to the various functions as per the OP that I get an > "UnboundLocalError: local variable 'tmp' referenced before assignment"? If you don't declare it as a global, and if you try to assi

Re: KeyboardInterrupt being lost?

2005-10-14 Thread David Wahler
Operation Latte Thunder wrote: > I have a simple test proggie that isn't behaving like I expect ( found > below ). The script will infinitely run ( as expected ), but seems to > completely ignore control-C's. Shouldn't the interpreter pass along > KeyboardInterrupts and break out of the while loo

threading/forking and IPC

2005-10-14 Thread Sophia Cao
Hello, I am seeking a python solution for my project. I am trying to implement an architecture where there is a server who receives incoming messages from several clients, then those messages need to be written to a MySQL database. To avoid too many connections to the database, I plan to save th

Re: Function to execute only once

2005-10-14 Thread snoe
The problem seemed to be because I was rebinding result inside executor. Can someone explain why it works below but not in the first one? Also why is it if I set tmp as a global and don't pass it as a paremeter to the various functions as per the OP that I get an "UnboundLocalError: local variable

Re: MS Word Outline -> reStructuredText script?

2005-10-14 Thread Jim
I'll look into that. I also found that Open Office can read the .doc file and then saveAs a DocBook xml file. I think DocUtils can parse and write both DocBook and reStructured text, but It'll take me some time to experiment with it. David Mertz has an article that shows reSt -> DocBook, I just

confusion between global names and instantiated object variable names

2005-10-14 Thread wanwan
I'm trying to make a GUI, but for some of the instantiated object variable names, the interpreter is looking at them as global names. Here is an example of what I did: class mygui: def __init__(self, root): self.menubar = Menu(root) # Game Menu

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Scott David Daniels
Try this: >>> import colorsys as cs >>> grey = (.7, .7, .7) >>> blue = (0., 0., 1.) >>> hsv_grey = cs.rgb_to_hsv(*grey) >>> hsv_blue = cs.rgb_to_hsv(*blue) >>> hsv_grey (0.0, 0.0, 0.69996) >>> hsv_blue (0.3, 1.0, 1.0) The problem is that the saturation of the gr

Re: Best way to handle cgi sessions

2005-10-14 Thread Christoph Haas
On Friday 14 October 2005 21:22, Derek Perriero wrote: > What would be the best way to create a cgi session that contains the > basic elements of a cookie and can also hold secure data, such as a > username/password. I've explored the possibilities of using SmartCookie, > but that doesn't encrypt m

Re: Function to execute only once

2005-10-14 Thread snoe
I've been seeing alot about decorators and closures lately and my initial thought was that this would be a good place to use them instead of wrapping it around a class. That was my initial thought :) What I came up with was this: def execute_once(fn): result = None def executor(*args, **k

Re: MS Word Outline -> reStructuredText script?

2005-10-14 Thread Graham Fawcett
Jim wrote: > Hi, > > I'm using reStructuredText as a format for some group documentation, > and often my co-workers take notes during meetings in Word's outline > mode. Does anyone already have a python script that will convert from > Word (or the Open Office file format version of a word document

Re: object inheritance and default values

2005-10-14 Thread Kay Schluehr
George Sakkis wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote: > > > I'm trying to implement simple svg style colored complex objects in > > tkinter and want to be able to inherit default values from other > > previously defined objects. > > > > I want to something roughly similar to ... > > > >

KeyboardInterrupt being lost?

2005-10-14 Thread Operation Latte Thunder
I have a simple test proggie that isn't behaving like I expect ( found below ). The script will infinitely run ( as expected ), but seems to completely ignore control-C's. Shouldn't the interpreter pass along KeyboardInterrupts and break out of the while loop, or am I missing something? Using py

Re: Inheritance...

2005-10-14 Thread Duncan Booth
KraftDiner wrote: > I have a base class > > class geometry(object): >def __init__(self): > self.blue = 1 > self.red = 2 >def render(self): > pass > > class square(geometry): > def __init__(self): > super(square, self).__init__() >def render(self) >

Re: Looking for a Python mentor

2005-10-14 Thread Christoph Haas
On Friday 14 October 2005 21:35, billie wrote: > "Nir Aides" wrote > > > Hello Len, > > > > You should try the #python IRC room. > > It is always very active and helpful. > > > > Nir > > Do you mean efnet #Python chan? > It's not too much active... I believe he meant irc.freenode.net :) Christo

Inheritance...

2005-10-14 Thread KraftDiner
I have a base class class geometry(object): def __init__(self): self.blue = 1 self.red = 2 def render(self): pass class square(geometry): def __init__(self): super(square, self).__init__() def render(self) print 'square' class circle(geometry): d

Inheritance...

2005-10-14 Thread KraftDiner
I have a base class class geometry(object): def __init__(self): self.blue = 1 self.red = 2 def render(self): pass class square(geometry): def __init__(self): super(square, self).__init__() def render(self) print 'square' class circle(geometry): d

Re: object inheritance and default values

2005-10-14 Thread George Sakkis
"Ron Adam" <[EMAIL PROTECTED]> wrote: > I'm trying to implement simple svg style colored complex objects in > tkinter and want to be able to inherit default values from other > previously defined objects. > > I want to something roughly similar to ... > > class shape(object): > def __

Re: Function to execute only once

2005-10-14 Thread Benji York
PyPK wrote: > now I want execute() function to get executed only once. That is the > first time it is accessed. How about just calculating the value at import time? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing lists

2005-10-14 Thread Scott David Daniels
Let me begin by apologizing to Christian as I was too snippy in my reply, and sounded even snippier than I meant to. Christian Stapfer wrote: > "Scott David Daniels" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >>a "better" set implementation will win if >>it can show better perfo

Re: Moving to Win XP as a Python developer

2005-10-14 Thread Thomas Heller
Trent Mick <[EMAIL PROTECTED]> writes: > [Thomas Heller wrote] >> I have an elisp function bound to a key in XEmacs that starts cmd in the >> directory where the current buffer is. IMO this is very convenient. To >> access explorer from that command prompt (in the rare cases that I need >> it) I

MS Word Outline -> reStructuredText script?

2005-10-14 Thread Jim
Hi, I'm using reStructuredText as a format for some group documentation, and often my co-workers take notes during meetings in Word's outline mode. Does anyone already have a python script that will convert from Word (or the Open Office file format version of a word document) to reStructured Text

Re: Looking for a Python mentor

2005-10-14 Thread billie
"Nir Aides" wrote > Hello Len, > > You should try the #python IRC room. > It is always very active and helpful. > > Nir Do you mean efnet #Python chan? It's not too much active... -- http://mail.python.org/mailman/listinfo/python-list

Re: Function to execute only once

2005-10-14 Thread Paul Rubin
"PyPK" <[EMAIL PROTECTED]> writes: > now I want execute() function to get executed only once. That is the > first time it is accessed. > so taht when funcc2 access the execute fn it should have same values as > when it is called from func1. There's nothing built into Python for that. You have to

Re: Moving to Win XP as a Python developer

2005-10-14 Thread Trent Mick
[Thomas Heller wrote] > I have an elisp function bound to a key in XEmacs that starts cmd in the > directory where the current buffer is. IMO this is very convenient. To > access explorer from that command prompt (in the rare cases that I need > it) I use 'start .'. I kind of have the same thing

Re: Function to execute only once

2005-10-14 Thread Jaime Wyant
If I understand you correctly, you want `tmp' to be global... If so, declare it as so in execute -> def execute(): global tmp tmp = tmp+1 return tmp Otherwise, what happens is that you declare a variable local to execute, that is named tmp. When the assignment occurs it uses the glo

Best way to handle cgi sessions

2005-10-14 Thread Derek Perriero
What would be the best way to create a cgi session that contains the basic elements of a cookie and can also hold secure data, such as a username/password.  I've explored the possibilities of using SmartCookie, but that doesn't encrypt my parameters.Here's some background info on what I'm trying to

Function to execute only once

2005-10-14 Thread PyPK
Hi if I have a function called tmp=0 def execute(): tmp = tmp+1 return tmp also I have def func1(): execute() and def func2(): execute() now I want execute() function to get executed only once. That is the first time it is accessed. so taht when funcc2 access the

Re: [ANN] XPN 0.5.5 released

2005-10-14 Thread Cousin Stanley
>> Can I install the newer xpn version >> and move the older data files into it >> without reconfiguring & reloading data files ? Cousin Nemesis This worked OK with no problems and I'm posting this reply via xpn-0.5.5 I copied the following from the older xpn-0.5.0 version

Re: Moving to Win XP as a Python developer

2005-10-14 Thread Thomas Heller
Scott David Daniels <[EMAIL PROTECTED]> writes: > Christian Stapfer wrote: >> "John J. Lee" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>>cmd.exe can be made bearable >>> >>>0. Make a shortcut to cmd.exe, stick it somewhere get-at-able, >>> eg. quick launch toolbar > I

object inheritance and default values

2005-10-14 Thread Ron Adam
I'm trying to implement simple svg style colored complex objects in tkinter and want to be able to inherit default values from other previously defined objects. I want to something roughly similar to ... class shape(object): def __init__(self, **kwds): # set a bunch

  1   2   >