Re: catching my own exception

2010-06-20 Thread Peter Otten
Nikola Skoric wrote: > Dana Fri, 18 Jun 2010 20:01:45 +0200, > Peter Otten <__pete...@web.de> kaze: >> Solution: move your startup code into a separate file and have it import >> the village module. > > Excellent, thanks! Everything works now, but I still don't quite get what > the problem is...

plac 0.5 is out!

2010-06-20 Thread Michele Simionato
A few weeks ago I presented on this list my most recent effort, plac. Now there is a *huge* new release: the size of plac and of its documentation doubled. Now plac is much more than a simple command-line arguments parser: it is also a generic tool to write command languages, similar to the cmd mo

Re: plac 0.5 is out!

2010-06-20 Thread Andre Alexander Bell
On 06/20/2010 11:22 AM, Michele Simionato wrote: > A few weeks ago I presented on this list my most recent effort, plac. > Now there is a *huge* new release: > the size of plac and of its documentation doubled. How about adding some support for internationalization of the generated usage output?

Re: daemonizing after binding to port

2010-06-20 Thread Ben Finney
mk writes: > I'm starting a SocketServer.TCPServer in my program, but since I want > to report problems to script starting the program, I want to go daemon > *after* TCPServer has done binding to port. > > Is this likely to cause problems? I mean, my client works when I do > the above, that is, i

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread DivX
On 20 lip, 02:52, Steven D'Aprano wrote: > On Sat, 19 Jun 2010 13:36:57 -0700, DivX wrote: > > On 19 lip, 21:18, geremy condra wrote: > >> On Sat, Jun 19, 2010 at 11:53 AM, DivX wrote: > >> > I found on the forum some discussion about crypting text and one guy > >> > did make assembly implementa

Pick items from list with probability based upon property of list member ?

2010-06-20 Thread southof40
I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which each car object from the original list appe

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Stefan Behnel
southof40, 20.06.2010 12:19: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which each car obj

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Steven D'Aprano
On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: > On 20 lip, 02:52, Steven D'Aprano cybersource.com.au> wrote: [...] >> I think that mixing assembly and python is a gimmick of very little >> practical significance. If you really need the extra performance, check >> out PyPy, Cython, Pyrex and Psy

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Steven D'Aprano
On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote: > I have list of of N Vehicle objects - the only possible vehicles are > cars, bikes, trucks. > > I want to select an object from the list with a probability of : cars > 0.7, bikes 0.3, trucks 0.1. That adds to a probability of 1.1, which is i

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Rob Williscroft
southof40 wrote in news:da3cc892-b6dd-4b37-a6e6- b606ef967...@t26g2000prt.googlegroups.com in gmane.comp.python.general: > I have list of of N Vehicle objects - the only possible vehicles are > cars, bikes, trucks. > > I want to select an object from the list with a probability of : cars > 0.7, b

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Cameron Simpson
On 20Jun2010 12:44, Stefan Behnel wrote: | southof40, 20.06.2010 12:19: | >I have list of of N Vehicle objects - the only possible vehicles are | >cars, bikes, trucks. | > | >I want to select an object from the list with a probability of : cars | >0.7, bikes 0.3, trucks 0.1. | > | >I've currently

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread DivX
On 20 lip, 12:46, Steven D'Aprano wrote: > On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: > > On 20 lip, 02:52, Steven D'Aprano > cybersource.com.au> wrote: > [...] > >> I think that mixing assembly and python is a gimmick of very little > >> practical significance. If you really need the extra

setup server from scratch (with or without apache?)

2010-06-20 Thread News123
Hi, So far I never really had to ask this question and this is also, why I am stil a little shaky on this topic: So far the typical LAMP server existed already and contained already a lot of existing PHP web applications, which I couldn't remove. Therefore I just used mod_python to implement som

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Mel
southof40 wrote: > I have list of of N Vehicle objects - the only possible vehicles are > cars, bikes, trucks. > > I want to select an object from the list with a probability of : cars > 0.7, bikes 0.3, trucks 0.1. > > I've currently implemented this by creating another list in which each > car ob

Re: plac 0.5 is out!

2010-06-20 Thread Michele Simionato
On Jun 20, 12:02 pm, Andre Alexander Bell wrote: > > How about adding some support for internationalization of the generated > usage output? The usage message of plac is actually generated by the underlying argparse library. argparse use gettext internally, so I would say the support is already t

question about multiprocessing

2010-06-20 Thread hywhy
first sorry for my poor english. Is there any problem in the follow code? thanks! from multiprocessing.managers import BaseManager import Queue class CrawlerManager(BaseManager): pass downloader_queue = Queue.Queue() downloader_queue.put('hello') CrawlerManager.register('get_down

Re: daemonizing after binding to port

2010-06-20 Thread Nobody
On Sun, 20 Jun 2010 20:00:14 +1000, Ben Finney wrote: >> I'm starting a SocketServer.TCPServer in my program, but since I want >> to report problems to script starting the program, I want to go daemon >> *after* TCPServer has done binding to port. >> >> Is this likely to cause problems? I mean, my

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Nobody
On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote: > I want to select an object from the list with a probability of : cars > 0.7, bikes 0.3, trucks 0.1. > > I've currently implemented this by creating another list in which each > car object from the original list appears 7 times, each bike 3 ti

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Steven D'Aprano
On Sun, 20 Jun 2010 11:27:30 +, Mel wrote: > southof40 wrote: > >> I have list of of N Vehicle objects - the only possible vehicles are >> cars, bikes, trucks. >> >> I want to select an object from the list with a probability of : cars >> 0.7, bikes 0.3, trucks 0.1. >> >> I've currently imple

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Paul Rubin
southof40 writes: > I want to select an object from the list with a probability of : cars > 0.7, bikes 0.3, trucks 0.1. You can do it with one pass through the list using a well-known online algorithm (I don't remember what it's called). Untested code: import random tprob = 0 # total prob

[ANN] pyxser-1.4.4r --- Python Object to XML serializer/deserializer

2010-06-20 Thread Daniel Molina Wegener
Hello Python Community. I'm pleased to announce pyxser-1.4.4r, a python extension which contains functions to serialize and deserialize Python Objects into XML. It is a model based serializer. Here is the ChangeLog entry for this release: ---8<--- 1.4.4r (2010.02.10): Daniel Molina Wegen

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread duncan smith
southof40 wrote: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which each car object from the

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Lie Ryan
On 06/20/10 20:57, DivX wrote: > On 20 lip, 12:46, Steven D'Aprano cybersource.com.au> wrote: >> On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: >>> On 20 lip, 02:52, Steven D'Aprano >> cybersource.com.au> wrote: >> [...] I think that mixing assembly and python is a gimmick of very little >>>

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Terry Reedy
On 6/20/2010 12:41 PM, Lie Ryan wrote: On 06/20/10 20:57, DivX wrote: On 20 lip, 12:46, Steven D'Aprano wrote: On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: On 20 lip, 02:52, Steven D'Aprano wrote: [...] I think that mixing assembly and python is a gimmick of very little practical signif

Re: plac 0.5 is out!

2010-06-20 Thread Andre Alexander Bell
On 06/20/2010 11:22 AM, Michele Simionato wrote: > A few weeks ago I presented on this list my most recent effort, plac. > Now there is a *huge* new release: > the size of plac and of its documentation doubled. > [...] > > http://micheles.googlecode.com/hg/plac/doc/plac.html I've read this one..

Re: MySQLdb and bits

2010-06-20 Thread John Nagle
On 6/19/2010 5:24 PM, voidnothings wrote: On Jun 13, 5:52 am, Dafydd Hughes wrote: Hi there This is my first post to the list - please forgive me if this has been addressed elsewhere. I'm running MySQL 32-bit in Snow Leopard, and had MySQLdb working well. I switched to 64-bit, rebuilt MySQLdb

Re: If Not CGI...

2010-06-20 Thread John Nagle
On 6/19/2010 11:18 AM, Stephen Hansen wrote: FastCGI is a different kind of approach to the problem; it launches Python alongside Apache, and that Python stays alive forever. It just redirects requests to said process when they come in. I know very little about this model, but believe its meant t

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Rhodri James
Mixing Python and assembler is a bizarre thing to want to do in general, but... On Sun, 20 Jun 2010 01:52:15 +0100, Steven D'Aprano wrote: (3) Modern C compilers can produce better (faster, more efficient) machine code than the best assembly code written by hand. No. Modern C compilers

Re: catching my own exception

2010-06-20 Thread Nikola Skoric
Dana Sun, 20 Jun 2010 10:53:08 +0200, Peter Otten <__pete...@web.de> kaze: > Now in your case village.py is first run as the main script and then [...] > In the account module you indirectly raise village.ExceptionWithLongName and > in __main__ you try to catch __main__.ExceptionWithLongName. P

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Dave Angel
DivX wrote: On 20 lip, 12:46, Steven D'Aprano wrote: On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote: On 20 lip, 02:52, Steven D'Aprano wrote: [...] I think that mixing assembly and python is a gimmick of very little practical significance. If you really need the extra pe

bug in parser?

2010-06-20 Thread Neal Becker
Isn't this a bug? print \" SyntaxError: unexpected character after line continuation character -- http://mail.python.org/mailman/listinfo/python-list

Re: bug in parser?

2010-06-20 Thread Grant Edwards
On 2010-06-20, Neal Becker wrote: > Isn't this a bug? > > print \" > > SyntaxError: unexpected character after line continuation character No. http://www.google.com/search?q=python+line+continuation+character First hit: http://docs.python.org/reference/lexical_analysis.html Section 2.1.5

Re: bug in parser?

2010-06-20 Thread Terry Reedy
On 6/20/2010 7:22 PM, Neal Becker wrote: Isn't this a bug? print \" SyntaxError: unexpected character after line continuation character This is definitely a syntax error. The message is about as good an interpretation of nonsensical situation as one could expect from an automaton. Terry J

PyCon Australia 2010 Registration Closes Tomorrow

2010-06-20 Thread Richard Jones
Hi all, PyCon Australia 2010, to be held at the Sydney Masonic Center over the weekend of June 26 and 27, is only days away. REGISTRATION WILL CLOSE TOMORROW (JUNE 22) AT 1PM! You have until 1PM tomorrow to register and pay. Register here: http://pycon-au.org/reg We will NOT be accepting regis

Re: C interpreter in Lisp/scheme/python

2010-06-20 Thread Define Macro
On Jun 13, 7:07 pm, bolega wrote: > I am trying to compare LISP/Scheme/Python for their expressiveness. > > For this, I propose a vanilla C interpreter. I have seen a book which > writes C interpreter in C. > > The criteria would be the small size and high readability of the code. > > Are there al

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread duncan smith
duncan smith wrote: southof40 wrote: I have list of of N Vehicle objects - the only possible vehicles are cars, bikes, trucks. I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which eac

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Steven D'Aprano
On Sun, 20 Jun 2010 18:21:43 -0400, Dave Angel wrote: > Something's intrinsically wrong with the argument made in this thread > against generating assembly code. That's exactly what happens every > time you write code in C. I don't know whether C compilers generate assembly mnemonics or direct

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Steven D'Aprano
On Sun, 20 Jun 2010 22:45:14 +0100, Rhodri James wrote: > Mixing Python and assembler is a bizarre thing to want to do in general, > but... > > On Sun, 20 Jun 2010 01:52:15 +0100, Steven D'Aprano > wrote: > >> (3) Modern C compilers can produce better (faster, more efficient) >> machine code th

Re: D-CM; Software Testers

2010-06-20 Thread Stephen Hansen
On 6/19/10 11:52 PM, Kruptein wrote: >> What does it *do*? > You're perfectly right about not doing that! > > So the program is kind of a platform to which several addons can be > added. > I've made some base addons that work well together. > These addons are tools that you in my opinion need to d

Re: plac 0.5 is out!

2010-06-20 Thread Michele Simionato
On Jun 20, 8:26 pm, Andre Alexander Bell wrote: > On 06/20/2010 11:22 AM, Michele Simionato wrote: > > > A few weeks ago I presented on this list my most recent effort, plac. > >  http://micheles.googlecode.com/hg/plac/doc/plac_ext.html > > But this one is broken. :( Aagh! The good one is http://

OT! Python vs... Objective-C!

2010-06-20 Thread Stephen Hansen
This is sort of OT. Okay, I consider it completely OT, because I hate these threads. But this isn't that sort of thread. I'm not going to tell you how Python is perfect -- it is, obviously. I'm not going to tell you how Objective-C is horrible -- its not, really. I'm not interested in debating the

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Paul Rubin
Steven D'Aprano writes: > Not that I don't believe you, but that is an extraordinary claim that > would require more evidence than just "Hey, some guy on the Internet > reckons his assembly code can regularly out-perform optimizing C > compilers" before I will change my opinion *wink* It is re

tkInter Listbox question

2010-06-20 Thread Anthony Papillion
So I'm trying to add a Listbox to my window. I want it to be the width of my window and the height of my window. I'm using the following code ('root' is my toplevel window): gsItems = Listbox(root, width=root.winfo_width(), height=root.winfo_height()) gsItems.pack() While you would think this co

start and kill process by command promt

2010-06-20 Thread shanti bhushan
Hi, I want to invoke local wen server named mogoose, and kill it after some time by python script. Then i want to change the argument and invoke it again. I am able to do this with below code. import subprocess import time def invoke_server1(): s1ret=subprocess.Popen(r'C:\WINDOWS\system32\cm

Re: D-CM; Software Testers

2010-06-20 Thread Kruptein
On 21 jun, 05:37, Stephen Hansen wrote: > On 6/19/10 11:52 PM, Kruptein wrote: > > That's better. :) > > I would suggest adding a little more: some bullet points of how they > work together in a way that's new or efficient or what's compelling > about the interaction. And a screenshot or two. > >

Re: setup server from scratch (with or without apache?)

2010-06-20 Thread Kruptein
I think that apache and mod_python are good enough, but I'm not an expert. but I think that the security aspect for a large part depends on how secure your code is. You can have a very secure server setting, but somewhere a bug in your code that makes it insecure. -- http://mail.python.org/mailm

Re: setup server from scratch (with or without apache?)

2010-06-20 Thread Paul Rubin
News123 writes: > 1.) What alternatives would exist compared to apache / mod_python I think you could use stunnel to listen on port 443 and forward it to a local port, where you'd have a python httpd, perhaps using the SimpleHTTPServer module. Stunnel uses OpenSSL which handles client certificat

Re: start and kill process by command promt

2010-06-20 Thread shanti bhushan
On Jun 21, 10:41 am, shanti bhushan wrote: > Hi, > I want to invoke local wen server named mogoose, and kill it after > some time by python script. > Then i want to change the argument and invoke it again. > > I am able to do this with below code. > > import subprocess > import time > > def invoke

Re: setup server from scratch (with or without apache?)

2010-06-20 Thread alex23
Paul Rubin wrote: > mod_python is pretty dead. It's now totally dead[1]. (Not pining for the fjords, either.) 1: http://blog.dscpl.com.au/2010/06/modpython-project-is-now-officially.html -- http://mail.python.org/mailman/listinfo/python-list

Re: setup server from scratch (with or without apache?)

2010-06-20 Thread Stefan Behnel
News123, 20.06.2010 13:12: Now I have the opportunity to setup a server from scratch. 90% of the content will be non visual content over https with client AND server certificates. Access privileges will depend on the client certificate. I will only have one IP address and only port 443. 1.) Wha