Problem obtaining an object reference...

2008-08-06 Thread SamG
I have two windowing classes A and B. Inside A's constructor i created an instance B to display its Modal window. Only on clicking OK/ Closing this modal window do i proceed to display the A's window. All that is fine. Now the problem is i would like to write a python script to test the this GUI

Re: More Datastore Examples Please

2008-08-06 Thread Tim Roberts
v4vijayakumar <[EMAIL PROTECTED]> wrote: > >Google appengine datastore is not very clear, and I couldn't get much >from API documents. It would be very helpful if there are some more >detailed documents with examples. I would gently suggest that you are not trying hard enough. I had never encount

Re: Best practise implementation for equal by value objects

2008-08-06 Thread Slaunger
On 7 Aug., 04:34, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 06 Aug 2008 05:50:35 -0700, Slaunger wrote: > > Hi, > > > I am new here and relatively new to Python, so be gentle: > > > Is there a recommended generic implementation of __repr__ for objects > > equal by valu

Re: Best practise implementation for equal by value objects

2008-08-06 Thread Slaunger
On 6 Aug., 21:46, John Krukoff <[EMAIL PROTECTED]> wrote: > On Wed, 2008-08-06 at 05:50 -0700, Slaunger wrote: > > Hi, > > > I am new here and relatively new to Python, so be gentle: > > > Is there a recommended generic implementation of __repr__ for objects > > equal by value to assure that eval(r

Re: benchmark

2008-08-06 Thread Steven D'Aprano
On Thu, 07 Aug 2008 07:49:45 +0200, Stefan Behnel wrote: > Jack wrote: >> I know one benchmark doesn't mean much but it's still disappointing to >> see Python as one of the slowest languages in the test: >> >> http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java- python-ruby-jython

Re: Best practise implementation for equal by value objects

2008-08-06 Thread Slaunger
On 6 Aug., 21:36, Terry Reedy <[EMAIL PROTECTED]> wrote: > Slaunger wrote: > > Hi, > > > I am new here and relatively new to Python, so be gentle: > > > Is there a recommended generic implementation of __repr__ for objects > > equal by value to assure that eval(repr(x)) == x independet of which > >

Re: random numbers according to user defined distribution ??

2008-08-06 Thread Steven D'Aprano
On Wed, 06 Aug 2008 21:09:30 -0700, Dan Bishop wrote: >> There's no general way to create a random function for an arbitrary >> distribution. I don't think there's a general way to *describe* an >> arbitrary random distribution. > > What about the quantile function? Well, sure, if you can write

Re: benchmark

2008-08-06 Thread Stefan Behnel
Jack wrote: > I know one benchmark doesn't mean much but it's still disappointing to see > Python as one of the slowest languages in the test: > > http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ > Just ignore that. If the code had been desig

RE: A question about string and float number

2008-08-06 Thread Tyler Breisacher
It's generally a bad idea to use "except" without naming a specific exception. The exception you might expect in this case is ValueError. Any other exception *should* be uncaught if it happens. By the way, this method will return true for integers as well as floats. For example, isFloat('3') wi

Re: random numbers according to user defined distribution ??

2008-08-06 Thread Paul Rubin
Alex <[EMAIL PROTECTED]> writes: > I wonder if it is possible in python to produce random numbers > according to a user defined distribution? That can mean a lot of things. The book "Numerical Recipes" (there are editions for various languages, unfortunately not including Python last time I looke

Re: random numbers according to user defined distribution ??

2008-08-06 Thread Dan Bishop
On Aug 6, 8:26 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 06 Aug 2008 15:02:37 -0700, Alex wrote: > > Hi everybody, > > > I wonder if it is possible in python to produce random numbers according > > to a user defined distribution? Unfortunately the random module doe

Re: Function from C/PHP to Python

2008-08-06 Thread Steven D'Aprano
On Wed, 06 Aug 2008 20:15:11 -0700, Grom wrote: > Hello everyone :) > I have one problem with that function in C ... > Can someone help me to rewrite it to python? > > There is the same function, in PHP: ... > Please... its very important to me I don't know C or PHP. But since it's important, an

Function from C/PHP to Python

2008-08-06 Thread Grom
Hello everyone :) I have one problem with that function in C int calc_passcode(const char* pass, char* code) { int magic1 = 0x50305735; int magic2 = 0x12345671; int sum = 7; char z; while ((z = *pass++) != 0) { if (z == ' ') continue; if (z == '\t') continue;

Re: Dictionary to tree format (hopefully simple)

2008-08-06 Thread John Nagle
Diez B. Roggisch wrote: Adam Powell schrieb: Hi! I have seemingly simple problem, which no doubt someone out there has already solved, but I'm stumped. Imagine I have a dictionary like below, in which the keys are parent nodes and the values are a list of children nodes. dict = { 0: [1, 2], 1:

Re: Parsing of a file

2008-08-06 Thread bearophileHUGS
Paul McGuire: > This code creates a single dict for the input lines, keyed by id. > Each value contains elements labeled 'id', 'ra', and 'mjd'. ... > d = dict( > (rec.split()[1][:-1], > dict([('id',rec.split()[1][:-1])] + > [map(str.lower,f.split('=')) >

Re: Best practise implementation for equal by value objects

2008-08-06 Thread Steven D'Aprano
On Wed, 06 Aug 2008 05:50:35 -0700, Slaunger wrote: > Hi, > > I am new here and relatively new to Python, so be gentle: > > Is there a recommended generic implementation of __repr__ for objects > equal by value to assure that eval(repr(x)) == x independet of which > module the call is made from?

RE: A question about string and float number

2008-08-06 Thread Edwin . Madari
#this is a better way of testing a string for float def isFloat(s): try: s = float(s) except: return False return True -Original Message- From: Madari, Edwin Sent: Wednesday, August 06, 2008 10:22 PM To: 'Wei Guo'; python-list@python.org Subject: RE: A question

RE: A question about string and float number

2008-08-06 Thread Edwin . Madari
type(s) == type(float()) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Wei Guo Sent: Wednesday, August 06, 2008 9:23 PM To: python-list@python.org Subject: A question about string and float number Hi all, I am new of python. Could anyone help me a quest

Re: os.system question

2008-08-06 Thread Larry Wang
os.system() simply executes the command in a subshell, and returns the command's exit status which in your case is '0'. If you need to capture the stdout, stderr, etc. stuff, subprocess module is preferred which offers more powerful functionalities over os.system(). Nessus "Kevin Walzer" <[EM

Re: benchmark

2008-08-06 Thread bearophileHUGS
On Aug 7, 2:05 am, "Jack" <[EMAIL PROTECTED]> wrote: > I know one benchmark doesn't mean much but it's still disappointing to see > Python as one of the slowest languages in the test: > > http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-p... That Python code is bad, it contains

Re: random numbers according to user defined distribution ??

2008-08-06 Thread Steven D'Aprano
On Wed, 06 Aug 2008 15:02:37 -0700, Alex wrote: > Hi everybody, > > I wonder if it is possible in python to produce random numbers according > to a user defined distribution? Unfortunately the random module does not > contain the distribution I need :-( This is a strange question. Of course you

Re: os.system question

2008-08-06 Thread Steven D'Aprano
On Wed, 06 Aug 2008 21:07:40 -0400, Kevin Walzer wrote: import os > >>> foo = os.system('whoami') > kevin > >>> print foo > 0 > >>> > >>> > The standard output of the system command 'whoami' is my login name. Yet > the value of the 'foo' object is '0,' not 'kevin.' How can I get the > val

A question about string and float number

2008-08-06 Thread Wei Guo
Hi all, I am new of python. Could anyone help me a question as below? Is there any function that can judge a string s is a float number or not? FOr example, if s = '1.232' or s='1e+10', then it returns true, otherwise, it will return false. isdigit() in string doesn't work. float() will throw an

os.system question

2008-08-06 Thread Kevin Walzer
>>> import os >>> foo = os.system('whoami') kevin >>> print foo 0 >>> The standard output of the system command 'whoami' is my login name. Yet the value of the 'foo' object is '0,' not 'kevin.' How can I get the value of 'kevin' associated with foo? -- Kevin Walzer Code by Kevin http://www.co

Re: Tkinter fullscreen with Mac OS X

2008-08-06 Thread C Martin
On Jul 28, 6:43 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > > You could try this, supposing tl is a toplevel: > > tl.tk.call("::tk::unsupported::MacWindowStyle", "style", tl._w, "plain", > "none") > I tried this (although, my tl is actually a tk instance): self.tk.call("::tk::unsupported::

Re: benchmark

2008-08-06 Thread Jake Anderson
Jack wrote: I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ -- http://mail.python.org/mailman/listinfo/python-l

benchmark

2008-08-06 Thread Jack
I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Using an DTD not specified in XML file for validation

2008-08-06 Thread Edwin . Madari
can you edit the xml and add the dtd/scheama ? .Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Finney Sent: Wednesday, August 06, 2008 7:07 PM To: python-list@python.org Subject: Re: Using an DTD not specified in XML file for validation Brian

Re: Parsing of a file

2008-08-06 Thread Paul McGuire
On Aug 6, 3:14 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > Regular expressions will do the trick nicely. > Or just use str.split, and create dicts using dict(list_of_tuples) constructor. This code creates a single dict for the input lines, keyed by id. Each value contains elements labeled '

Re: Using an DTD not specified in XML file for validation

2008-08-06 Thread Ben Finney
Brian Quinlan <[EMAIL PROTECTED]> writes: > I'm trying to figure out how I can validate an XML file using a DTD > that isn't specified in the XML file. When your inention is to start a new discussion, you could compose a new message, *not* reply to an existing message. Your message here is now pa

Re: Parsing of a file

2008-08-06 Thread Henrique Dante de Almeida
On Aug 6, 3:55 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > I have a file with the format > > Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames   > 5 Set 1 > Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames   > 5 Set 2 > Field f31226: Ra=20:24:45.50 Dec=+78

Adding Microsoft objects in Boa Constuctor Palette

2008-08-06 Thread Sid K
This is what I wanted to do: Add Microsoft Active objects like Excel sheets and Word files to the Palette in Boa Constructor. There is a User tab in the GUI builder menu, but I'm not sure how to use/enable it. 1. Does anyone know how to do this? 2. Is anyone aware of any work that is currently go

python equivalent for this perl soap client

2008-08-06 Thread Edwin . Madari
use SOAP::Lite; use Data::Dumper; $ENV{HTTP_proxy} = "my_proxy_server_not_soap_proxy_server"; $ENV{HTTP_proxy_user} = ""; #set correct value $ENV{HTTP_proxy_pass} = ""; #set correct value my $soap = SOAP::Lite ->service('file:./local_file_copy_of_wsdl.wsdl'); my $som = $soap->soapMethod("method",

Re: pyprocessing/multiprocessing for x64?

2008-08-06 Thread pigmartian
Interesting, I see Christian's responses to Benjamin, but not Benjamin's posts themselves. Anyways, the question remains: will multiprocessing be supported for the x64 platform when it's released in 2.6? pigmartian wrote: I recently learned (from I response on this newsgroup to an earlier qu

Re: random numbers according to user defined distribution ??

2008-08-06 Thread Dominic van Berkel
On Thursday 07 August 2008 00:02, Alex <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I wonder if it is possible in python to produce random numbers > according to a user defined distribution? > Unfortunately the random module does not contain the distribution I > need :-( > > Many thanks > >

random numbers according to user defined distribution ??

2008-08-06 Thread Alex
Hi everybody, I wonder if it is possible in python to produce random numbers according to a user defined distribution? Unfortunately the random module does not contain the distribution I need :-( Many thanks axel -- http://mail.python.org/mailman/listinfo/python-list

cross-compilation

2008-08-06 Thread Roumen Petrov
Hi list members, It seems to me that this is discussed many times in the past but without progress. As I understand in general there is no objections and preferred cross-compilation has to be based on distutils (scons was rejected). So I would like to cross-compile from linux(build system)

Re: Parsing of a file

2008-08-06 Thread John Machin
On Aug 7, 7:06 am, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 7, 6:02 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Aug 6, 1:55 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > > > > I have a file with the format > > > > Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Fr

Re: Psycho question

2008-08-06 Thread bearophileHUGS
Erik Max Francis: > If len(bytes) is large, you might want to use `xrange`, too. `range` > creates a list which is not really what you need. That's right for Python, but Psyco uses normal loops in both cases, you can time this code in the two situations: def foo1(n): count = 0 for i in r

Re: Parsing of a file

2008-08-06 Thread bearophileHUGS
Using something like PyParsing is probably better, but if you don't want to use it you may use something like this: raw_data = """ Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames 5 Set 1 Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames 5 Set 2 Field f31

Re: Parsing of a file

2008-08-06 Thread John Machin
On Aug 7, 6:02 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Aug 6, 1:55 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > > > > > I have a file with the format > > > Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames > > 5 Set 1 > > Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJ

Re: Psycho question

2008-08-06 Thread Erik Max Francis
David C. Ullrich wrote: Thanks. I would have guessed that I'd want low-level style code; that's the sort of thing I have in mind. In fact the only thing that seems likely to come up right now is looping through an array of bytes, modifying them. The plan is to use the array module first to conve

Re: Parsing of a file

2008-08-06 Thread Stefan Behnel
Shawn Milochik wrote: >> I would like to parse this file by extracting the field id, ra, dec and mjd >> for each line. It is >> not, however, certain that the width of each value of the field id, ra, dec >> or mjd is the same >> in each line. Is there a way to do this such that even if there was a

Re: Psycho question

2008-08-06 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > > David C. Ullrich: > > > Thanks. If I can get it installed and it works as advertised > > > this means I can finally (eventually) finish the process

Re: Run program from within Python

2008-08-06 Thread frankrentef
THNX for the links... lotta reading for the newbie! -- http://mail.python.org/mailman/listinfo/python-list

Re: Run program from within Python

2008-08-06 Thread giltay
On Aug 6, 3:42 pm, frankrentef <[EMAIL PROTECTED]> wrote: > stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1') What Mike said about subprocess. Also, in regular Python strings, \t means a tab character. You need to replace \ with \\ in the programme path ('c:\\test\\OpenProgram.exe 1 1

Re: Parsing of a file

2008-08-06 Thread Shawn Milochik
> > I would like to parse this file by extracting the field id, ra, dec and mjd > for each line. It is > not, however, certain that the width of each value of the field id, ra, dec > or mjd is the same > in each line. Is there a way to do this such that even if there was a line Regular expressions

Re: Books to begin learning Python

2008-08-06 Thread Mike Driscoll
On Aug 6, 2:56 pm, Edward Cormier <[EMAIL PROTECTED]> wrote: > Which computer books are the best to begin learning Python 2.5 with? > I've heard that Learning Python 3rd Edition is a good choice - can > anyone give any more advice on this? > > Thanks. There's lots of good books to read, including

Re: Parsing of a file

2008-08-06 Thread Mike Driscoll
On Aug 6, 1:55 pm, Tommy Grav <[EMAIL PROTECTED]> wrote: > I have a file with the format > > Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames   > 5 Set 1 > Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames   > 5 Set 2 > Field f31226: Ra=20:24:45.50 Dec=+78

Re: Run program from within Python

2008-08-06 Thread Mike Driscoll
On Aug 6, 2:42 pm, frankrentef <[EMAIL PROTECTED]> wrote: > Greetings all... > > Newbie to Python... need help with opening a file from within > Python... see the following code. > > import popen2 > stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1') > keygen = stdout.read() > print "The k

Books to begin learning Python

2008-08-06 Thread Edward Cormier
Which computer books are the best to begin learning Python 2.5 with? I've heard that Learning Python 3rd Edition is a good choice - can anyone give any more advice on this? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Calculate sha1 hash of a binary file

2008-08-06 Thread John Krukoff
On Wed, 2008-08-06 at 12:31 -0700, LaundroMat wrote: > Hi - > > I'm trying to calculate unique hash values for binary files, > independent of their location and filename, and I was wondering > whether I'm going in the right direction. > > Basically, the hash values are calculated thusly: > > f

Re: Psycho question

2008-08-06 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > David C. Ullrich: > > Thanks. If I can get it installed and it works as advertised > > this means I can finally (eventually) finish the process of > > dumping MS Windows: the only reason I need it right now is for > > the small number of

Parsing of a file

2008-08-06 Thread Tommy Grav
I have a file with the format Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames 5 Set 1 Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames 5 Set 2 Field f31226: Ra=20:24:45.50 Dec=+78:26:45.2 MJD=53370.06823860 Frames 5 Set 3 Field f31004: Ra=20:25:0

Re: Calculate sha1 hash of a binary file

2008-08-06 Thread Tim Golden
LaundroMat wrote: Hi - I'm trying to calculate unique hash values for binary files, independent of their location and filename, and I was wondering whether I'm going in the right direction. Basically, the hash values are calculated thusly: f = open('binaryfile.bin') import hashlib h = hashlib.

Re: Best practise implementation for equal by value objects

2008-08-06 Thread John Krukoff
On Wed, 2008-08-06 at 05:50 -0700, Slaunger wrote: > Hi, > > I am new here and relatively new to Python, so be gentle: > > Is there a recommended generic implementation of __repr__ for objects > equal by value to assure that eval(repr(x)) == x independet of which > module the call is made from?

Run program from within Python

2008-08-06 Thread frankrentef
Greetings all... Newbie to Python... need help with opening a file from within Python... see the following code. import popen2 stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1') keygen = stdout.read() print "The keygen value is: %s" % keygen from the command line if I execute "OpenPr

Re: SMTP via GMAIL

2008-08-06 Thread mmm
On Aug 5, 12:18 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > >But when using smtp.gmail.com as the server I learned that any > >@gmail.com address in the  Cc: text block would > >receive mail even if I changed the code to have the RECEIVERS list to > >ignore the CC addresses or not include the gma

Re: Best practise implementation for equal by value objects

2008-08-06 Thread Terry Reedy
Slaunger wrote: Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet of which module the call is made from? The CPython implementation gives up on that

Calculate sha1 hash of a binary file

2008-08-06 Thread LaundroMat
Hi - I'm trying to calculate unique hash values for binary files, independent of their location and filename, and I was wondering whether I'm going in the right direction. Basically, the hash values are calculated thusly: f = open('binaryfile.bin') import hashlib h = hashlib.sha1() h.update(f.re

virtual IPs

2008-08-06 Thread leo davis
Good Day! I have set up virtual IPs on my Ubuntu client machine & assigned IPs 192.168.12.3 - eth0 192.168.12.4 - eth0:1 192.168.12.5 - eth0:2 192.168.12.6 - eth0:3 I have written python code to send multiple HTTP requests to my web server to load test it.When I check the logs on the apache serve

Re: Find class of an instance?

2008-08-06 Thread Nikolaus Rath
Neal Becker <[EMAIL PROTECTED]> writes: > Sounds simple, but how, given an instance, do I find the class? It does not only sound simple. When 'inst' is your instance, then inst.__class__ or type(inst) is the class. Best, -Nikolaus -- »It is not worth an intelligent man's time to

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Tobiah <[EMAIL PROTECTED]> writes: > On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > >> Hello, >> >> I need to synchronize the access to a couple of hundred-thousand >> files[1]. It seems to me that creating one lock object for each of the >> files is a waste of resources, but I cannot

Re: Monitor and compare two log files in real time

2008-08-06 Thread Shawn Milochik
Can you be more specific? That will also help you write your requirements, which will lead to your pseudo code and then your code. Do you want to search for a a pre-defined string (or set of strings), or just look for anything matching a pattern to appear in the first file? Related question: Can t

RE: Monitor and compare two log files in real time

2008-08-06 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of m > Sent: Wednesday, August 06, 2008 1:25 PM > To: python-list@python.org > Subject: Monitor and compare two log files in real time > > I have a script I would like to write but I am not sure

Re: looking for IDE advice or workflow tips

2008-08-06 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I'm a novice developer at best and often work with the R statistical programming language. I use an editor called TINN-R which allows me to write a script, then highlight a few lines and send them to the interpreter. I am using pythonwin and it lacks this funtionality

Re: Any tips on Python web development on Mac OS

2008-08-06 Thread Bruno Desthuilliers
Tim Greening-Jackson a écrit : Bruno Desthuilliers wrote: Tim Greening-Jackson a écrit : (snip) Depends on what your "site" is doing. There are all *sorts* of things I would like it to do, but am not dogmatic about any of them. For example, having various people being able to login to it

Monitor and compare two log files in real time

2008-08-06 Thread m
I have a script I would like to write but I am not sure of where to start / approach. Perhaps someone could help direct me in the right direction. Any advice is appreciated. I would like to write a python script that monitors two log files. If a certain string, lets say string1 shows up in logfile

Using an DTD not specified in XML file for validation

2008-08-06 Thread Brian Quinlan
Hey, I'm trying to figure out how I can validate an XML file using a DTD that isn't specified in the XML file. My code so far is: from xml import sax from xml.sax import sax2exts parser = sax2exts.XMLValParserFactory.make_parser() parser.setContentHandler(handler) parser.setErrorHandler(han

Re: Psycho question

2008-08-06 Thread bearophileHUGS
David C. Ullrich: > Thanks. If I can get it installed and it works as advertised > this means I can finally (eventually) finish the process of > dumping MS Windows: the only reason I need it right now is for > the small number of Delphi programs I have for which straight > Python is really not adeq

Re: Limits of Metaprogramming

2008-08-06 Thread castironpi
On Aug 6, 7:24 am, Wilson <[EMAIL PROTECTED]> wrote: > On Aug 4, 9:23 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Aug 4, 1:57 pm, Wilson <[EMAIL PROTECTED]> wrote: > > > > On Aug 4, 6:49 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > > Two, if all your methods will have uniform signat

Re: More like a shell command.

2008-08-06 Thread castironpi
On Aug 6, 9:38 am, Bill <[EMAIL PROTECTED]> wrote: > Is there anyway I can extend python to accept a command > which looks more like shell syntax than a function call. > > I want to be able to do this: > >     if blah : >         MyCommand  Arg1  Arg2 > > as opposed to this: > >     if blah : >    

Re: enhancing decorator signatures

2008-08-06 Thread castironpi
On Aug 6, 7:16 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using Michele S's decorator-module to create decorators with matching > signatures, for better error-catching. > > However, I now want to enrich the signature of a generic wrapper so that the > new function will accept m

Re: regex question

2008-08-06 Thread Tobiah
On Tue, 05 Aug 2008 15:55:46 +0100, Fred Mangusta wrote: > Chris wrote: > >> Doesn't work for his use case as he wants to keep periods marking the >> end of a sentence. Doesn't it? The period has to be surrounded by digits in the example solution, so wouldn't periods followed by a space (end of

Re: Locking around

2008-08-06 Thread Tobiah
On Mon, 04 Aug 2008 15:30:51 +0200, Nikolaus Rath wrote: > Hello, > > I need to synchronize the access to a couple of hundred-thousand > files[1]. It seems to me that creating one lock object for each of the > files is a waste of resources, but I cannot use a global lock for all > of them either

Re: More like a shell command.

2008-08-06 Thread Thor
Maybe this module would work fine: http://docs.python.org/lib/module-cmd.html -- Angel -- http://mail.python.org/mailman/listinfo/python-list

Re: Psycho question

2008-08-06 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > > Just heard about Psycho. I've often wondered why someone > > doesn't make something that does exactly what Psycho does - keen. > > > > Silly question: It's correct, is it not, that Psycho

Re: More like a shell command.

2008-08-06 Thread Richie Hindle
[Bill] > Is there anyway I can extend python to accept a command > which looks more like shell syntax than a function call. > > I want to be able to do this: > > if blah : > MyCommand Arg1 Arg2 As a general rule, if Python gives you a syntax error then you can't achieve what you want

Re: More like a shell command.

2008-08-06 Thread Miki
Hello, > Is there anyway I can extend python to accept a command > which looks more like shell syntax than a function call. > > I want to be able to do this: > >     if blah : >         MyCommand  Arg1  Arg2 > > as opposed to this: > >     if blah : >         MyCommand(Arg1,Arg2) > > or this: > >

Re: More like a shell command.

2008-08-06 Thread Mike Driscoll
On Aug 6, 9:38 am, Bill <[EMAIL PROTECTED]> wrote: > Is there anyway I can extend python to accept a command > which looks more like shell syntax than a function call. > > I want to be able to do this: > >     if blah : >         MyCommand  Arg1  Arg2 > > as opposed to this: > >     if blah : >    

Has anyone used the Python-MMS libraries recently ? feedback / consultancy required

2008-08-06 Thread Ade Bamigboye
Hi We would like to talk with anyone who has recently used the Python-MMS libraries with the aim of creating a prototype SMIL to MMS tool. Regards Ade "CareTeamR - monitoring, managing, supporting patients" Wireless Matters Limited Tel : +44 844 736 5330 Mobile : +44 7768 356150 Sky

Re: Find class of an instance?

2008-08-06 Thread [EMAIL PROTECTED]
On 6 août, 15:52, Bruno Desthuilliers wrote: > Heiko Wundram a écrit : > > > Am Mittwoch, den 06.08.2008, 08:44 -0400 schrieb Neal Becker: > >> Sounds simple, but how, given an instance, do I find the class? > > > .__class__ > > Works for new-style classes only. The "generic" way to go is to use >

Re: Dictionary to tree format (hopefully simple)

2008-08-06 Thread Adam Powell
Thanks very much for this, very concise! -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: matplotlib-0.98.3 - plotting for python

2008-08-06 Thread bearophileHUGS
jdh2358: > delaunay triangularization [and more amazing things] I'm impressed, it's growing very well, congratulations, I use it now and then. I know people in University that use Python only/mostly because of matplotlib. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Find class of an instance?

2008-08-06 Thread Hugo
Neal Becker schreef: Sounds simple, but how, given an instance, do I find the class? I always do that with .__class__, not sure whether it is the best way: >>> class A: ... pass ... >>> a = A() >>> a.__class__ >>> a.__class__ == A True -- http://mail.python.org/mailman/listinfo/python-list

More like a shell command.

2008-08-06 Thread Bill
Is there anyway I can extend python to accept a command which looks more like shell syntax than a function call. I want to be able to do this: if blah : MyCommand Arg1 Arg2 as opposed to this: if blah : MyCommand(Arg1,Arg2) or this: if blah : x("MyCommand

Re: Locking around

2008-08-06 Thread MRAB
On Aug 6, 1:33 pm, Nikolaus Rath <[EMAIL PROTECTED]> wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > Freaky... I just posted nearly this exact solution. > > > I have a couple comments.  First, the call to acquire should come > > before the try block.  If the acquire were to fail, you wouldn't w

Re: Is there a faster way to do this?

2008-08-06 Thread Boris Borcic
Is your product ID always the 3rd and last item on the line ? Else your output won't separate IDs. And how does output = open(output_file,'w') for x in set(line.split(',')[2] for line in open(input_file)) : output.write(x) output.close() behave ? [EMAIL PROTECTED] wrote: I have a csv fil

How to create python codecs?

2008-08-06 Thread yrogirg
Actually, I need utf-8 to utf-8 encoding which would change the text to another keyboard layout (e.g. from english to russian ghbdtn -> привет) and would not affect other symbols. I`m totally new to python and to more or less advanced programming. I couldn`t find the answer to the question anywher

Best practise implementation for equal by value objects

2008-08-06 Thread Slaunger
Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet of which module the call is made from? Example: class Age: def __init__(self, an_age): sel

Re: Find class of an instance?

2008-08-06 Thread Heiko Wundram
Am Mittwoch, den 06.08.2008, 08:44 -0400 schrieb Neal Becker: > Sounds simple, but how, given an instance, do I find the class? .__class__ For example: Python 2.5.2 (r252:60911, Aug 5 2008, 03:26:50) [GCC 4.3.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>

Find class of an instance?

2008-08-06 Thread Neal Becker
Sounds simple, but how, given an instance, do I find the class? -- http://mail.python.org/mailman/listinfo/python-list

Re: Locking around

2008-08-06 Thread Nikolaus Rath
Carl Banks <[EMAIL PROTECTED]> writes: > Freaky... I just posted nearly this exact solution. > > I have a couple comments. First, the call to acquire should come > before the try block. If the acquire were to fail, you wouldn't want > to release the lock on cleanup. > > Second, you need to change

Re: Limits of Metaprogramming

2008-08-06 Thread Wilson
On Aug 4, 9:23 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 4, 1:57 pm, Wilson <[EMAIL PROTECTED]> wrote: > > > On Aug 4, 6:49 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > Two, if all your methods will have uniform signatures and closures, > > > you can store class methods as only their

ANN: matplotlib-0.98.3 - plotting for python

2008-08-06 Thread [EMAIL PROTECTED]
matplotlib is a 2D plotting library for python for use in scripts, applications, interactive shell work or web application servers. matplotlib 0.98.3 is a major but stable release which brings many new features detailed below. Homepage: http://matplotlib.sourceforge.net/ Downloads: http://sou

enhancing decorator signatures

2008-08-06 Thread Diez B. Roggisch
Hi, I'm using Michele S's decorator-module to create decorators with matching signatures, for better error-catching. However, I now want to enrich the signature of a generic wrapper so that the new function will accept more parameters (keyword only). These additional parameters are consumed by th

Re: sys.ps1 with formatting (linux)

2008-08-06 Thread Hugo
Hi all, My apologies for resurrecting an old thread, but I couldn't find the answer on the list and others might still have the same problem. On Mon Jul 23 22:33:22 CEST 2007, Jon Dobson wrote (reformatted): I'm trying to set sys.ps1 and sys.ps2 with some formatting using: sys.ps1="\033[1m\0

Re: Help with mechanize

2008-08-06 Thread Wojtek Walczak
Dnia Wed, 06 Aug 2008 07:16:37 -0400, Neal Becker napisa�(a): > I'm trying to use mechanize to read for a M$ mail server. I can get past the > login page OK using: ... > Now it seems if I read b.links() I can see links to my mail. My question is, > how do I now actually get the contents of this

Accessing tree nodes from the cgi

2008-08-06 Thread Noorhan Abbas
Hello, I wonder if anyone knows how to sort out this problem for me! I have a Yhaoo tree view control created using javascript and I don't know how to get the node selected from within my python cgi?  Anyone can help please? Nora __

Help with mechanize

2008-08-06 Thread Neal Becker
I'm trying to use mechanize to read for a M$ mail server. I can get past the login page OK using: import mechanize b = mechanize.Browser() b.open ('https://mail.hughes.com/owa/auth/logon.aspx?url=https://mail.hughes.com/OWA/&reason=0') b.select_form(nr=0) b['username']='myname' b['password']='

  1   2   >