Re: Dynamic method

2007-07-11 Thread Daniel Nogradi
> >> I have an issue I think Python could handle. But I do not have the > >> knowledge > >> to do it. > >> > >> Suppose I have a class 'myClass' and instance 'var'. There is function > >> 'myFunc(..)'. I have to add (or bind) somehow the function to the > >> class, or > >> the instance. Any help, i

Re: bool behavior in Python 3000?

2007-07-11 Thread Rob Wolfe
Steven D'Aprano wrote: > From a purely functional perspective, bools are unnecessary in Python. I > think of True and False as syntactic sugar. But they shouldn't be > syntactic sugar for 1 and 0 any more than they should be syntactic sugar > for {"x": "foo"} and {}. But `bools` are usefull in s

Re: Visualizing a wav file?

2007-07-11 Thread Wim Vogelaar
Perhaps you can use parts/routines of Audacity. See: http://en.wikipedia.org/wiki/Audacity Wim Vogelaar, http://home.wanadoo.nl/w.h.vogelaar/ -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Miles
On Jul 11, 2:50 am, Alan Isaac <[EMAIL PROTECTED]> wrote: > >>> bool(False-True) > > True What boolean operation does '-' represent? -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Stargaming
Alan Isaac schrieb: > Stargaming wrote: > >> I think Bjoern just wanted to point out that all those binary boolean >> operators already work *perfectly*. > > > bool(False-True) > > True > > But reread Steven. > > Cheers, > Alan Isaac What would you expect this operation to return the

Re: os.wait() losing child?

2007-07-11 Thread greg
Jason Zheng wrote: > Hate to reply to my own thread, but this is the working program that can > demonstrate what I posted earlier: I've figured out what's going on. The Popen class has a __del__ method which does a non-blocking wait of its own. So you need to keep the Popen instance for each subp

Re: Visualizing a wav file?

2007-07-11 Thread kaens
On 7/11/07, Wim Vogelaar <[EMAIL PROTECTED]> wrote: > Perhaps you can use parts/routines of Audacity. > See: http://en.wikipedia.org/wiki/Audacity > > Wim Vogelaar, http://home.wanadoo.nl/w.h.vogelaar/ > > > -- > http://mail.python.org/mailman/listinfo/python-list > I'm aware of audacity. Correct

Re: binascii.unhexlify ... not clear about usage, and output

2007-07-11 Thread Vishal
On May 30, 1:31 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Vishal wrote: > > I have a file with a long list of hex characters, and I want to get a > > file with corresponding binary characters > > > here's what I did: > > import binascii > f1 = 'c:\\temp\\allhex.txt' > f2 = 'c:\\te

Re: Dynamic method

2007-07-11 Thread Bruno Desthuilliers
Daniel Nogradi a écrit : (snip) >> > def method_for_instance( message ): >> >print message >> > >> > class myClass( object ): >> >pass >> > >> > inst = myClass( ) >> > inst.method = method_for_instance >> > >> > inst.method( 'hello' ) (snip) >> This won't work as expected: >> >> class Bidul

Where to find Python Enthought Edition for Linux?

2007-07-11 Thread Gundala Viswanath
Dear all, Is there any way I can download Python 2.4.3 Enthought Edition for Linux. AFAIK, from your website I can only find Enthought Tool Suite for Linux, which is not exactly what I want. The Enthought Edition is truly incredible. I want to re-place my original Python in my Linux box with Enth

Re: socket: connection reset by server before client gets response

2007-07-11 Thread Hendrik van Rooyen
"ahlongxp" <[EMAIL PROTECTED]> wrote: > I feel a little embarrassed now. There is nothing to be embarrassed about. Experience is a thing that is hard won. As someone once said: "no Pain, no Gain" - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Time A Script

2007-07-11 Thread Robert Rawlins - Think Blue
Hello Guys, What's the best way to time how long it takes a script to run, from top to bottom and then have it print that execution time at the end? Thanks guys, Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Visualizing a wav file?

2007-07-11 Thread Diez B. Roggisch
kaens wrote: > On 7/11/07, Wim Vogelaar <[EMAIL PROTECTED]> > wrote: >> Perhaps you can use parts/routines of Audacity. >> See: http://en.wikipedia.org/wiki/Audacity >> >> Wim Vogelaar, http://home.wanadoo.nl/w.h.vogelaar/ >> >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > >

Re: stripping the first byte from a binary file

2007-07-11 Thread rvr
On Jul 11, 1:28 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: > > Is there a way to edit the file in place? The best I seem to be able to > > do is to use your second solution to read the file into the string, then > > re-open the file for writing a

Re: stripping the first byte from a binary file

2007-07-11 Thread Stefan Behnel
rvr wrote: > On Jul 11, 1:28 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: >>> Is there a way to edit the file in place? The best I seem to be able to >>> do is to use your second solution to read the file into the string, then >>> re-open the fi

Re: Python IRC bot using Twisted

2007-07-11 Thread ddtm
I have another problem with my IRC bot. There is privmsg(self, user, channel, msg) function (this function handles the incoming IRC data) in the code that was mentioned above. I have a special condition in this function that if a user sends to bot a private message (in other words: if channel == se

Re: What is the most efficient way to test for False in a list?

2007-07-11 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Duncan Booth <[EMAIL PROTECTED]> writes: >>> status = not (False in list) >> That is an equality test, not an identity test: >> > False in [0] >> True > > Arrh! Strongly typed language, my eye ;-) Thanks. We're quite a few to still think that the introduction of

Re: SafeConfigParser can set unsafe values

2007-07-11 Thread Hamish Moffatt
Matimus wrote: >> I agree, but that was a trivial example to demonstrate the problem. >> Writing the file out to disk writes it exactly as set(), causing a get() >> to fail just the same later. > > No... The above statement is not true. Yes, it is. Whatever you set gets written out directly. Your

Re: Simple search and Display system, no need for db?

2007-07-11 Thread Helmut Jarausch
flit wrote: > Hello All, > > I was discussing with a friend and we get in a hot debate. > > We have homepage that act like a name list. > > The user goes there: > > - Choose the building -- Department and the user receive an html table > with all names . > > So the user gives two inputs and re

Re: Python IRC bot using Twisted

2007-07-11 Thread Jean-Paul Calderone
On Wed, 11 Jul 2007 03:51:27 -0700, ddtm <[EMAIL PROTECTED]> wrote: >I have another problem with my IRC bot. There is privmsg(self, user, >channel, msg) function (this function handles the incoming IRC data) >in the code that was mentioned above. I have a special condition in >this function that if

Re: pattern match !

2007-07-11 Thread Helmut Jarausch
[EMAIL PROTECTED] wrote: > Extract the application name with version from an RPM string like > hpsmh-1.1.1.2-0-RHEL3-Linux.RPM, i require to extract hpsmh-1.1.1.2-0 > from above string. Sometimes the RPM string may be hpsmh-1.1.1.2-RHEL3- > Linux.RPM. > Have a try with import re P=re.compile(r'(

Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 1:25 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > rvr wrote: > > On Jul 11, 1:28 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: > >>> Is there a way to edit the file in place? The best I seem to be able to > >>> do is to use your

Re: bool behavior in Python 3000?

2007-07-11 Thread Steve Holden
Steven D'Aprano wrote: > On Tue, 10 Jul 2007 16:41:58 -0700, Paul Rubin wrote: > >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> Pretending that False and True are just "magic names" for 0 and 1 might >>> be "easier" than real boolean algebra, but that puts the cart before >>> the horse. Functi

Screen Scraping Question

2007-07-11 Thread jeffbg123
Hey, I am trying to make a bot for a flash game using python. However I am having some trouble with a screen scraping strategy. Is there an accepted way to compare a full screenshot with the image that I want to locate? It is a math based game, so I just have to check what number, 1-9, appears in

Re: bool behavior in Python 3000?

2007-07-11 Thread Alan Isaac
Miles wrote: > What boolean operation does '-' represent? Complementation. And as usual, a-b is to be interpreted as a+(-b). In which case the desired behavior is False-True = False+(-True)=False+False = False In response to Stargaming, Steve is making a point about the incoherence of certain ar

Re: Portable general timestamp format, not 2038-limited

2007-07-11 Thread Martin Gregorie
Ilya Zakharevich wrote: > [A complimentary Cc of this posting was sent to > Martin Gregorie > <[EMAIL PROTECTED]>], who wrote in article <[EMAIL PROTECTED]>: >> Its in "A Short History of Time". Sorry I can't quote chapter or page, >> but a friend borrowed my copy and lent me Dawkins "Climbing Mo

Re: How to Machine A python script execute Machine B python script?

2007-07-11 Thread Antonio Cuni
johnny wrote: > Anyone know how I can make Machine A python script execute a python > script on Machine B ? have a look to py.execnet; in the simplest case, it does not need any special setup on machine B, just a working ssh server and a python interpreter installed: http://codespeak.net/py/dis

Re: bool behavior in Python 3000?

2007-07-11 Thread Alan Isaac
Since it is seemingly ignored in most of the comments on this thread, I just want to remind that PEP 285 http://www.python.org/dev/peps/pep-0285/ says this: In an ideal world, bool might be better implemented as a separate integer type that knows how to perform mixed-mode arit

Re: bool behavior in Python 3000?

2007-07-11 Thread Steven Bethard
Steven D'Aprano wrote: > On Tue, 10 Jul 2007 17:47:47 -0600, Steven Bethard wrote: >> But I think all you're really saying is that newbies don't expect things >> like +, -, *, etc. to work with bools at all. Which I agree is probably >> true. > > No, what I am saying is that True and False being i

Re: stripping the first byte from a binary file

2007-07-11 Thread Diez B. Roggisch
> > Forgive my newbie ignorance, but I am wondering why the other method > would not work? I mean it may not be very safe, > but I guess it may perform a lot better, than having to read the whole > file just to cut out the first byte. Because seeking is not moving? Shifting data bytewise isn't so

Re: Portable general timestamp format, not 2038-limited

2007-07-11 Thread Hendrik van Rooyen
"greg" <[EMAIL PROTECTED]> wrote: > > Another thought: If the cosmologists ever decide if > and when the Big Crunch is going to happen, we may be > able to figure out once and for all how many bits we > need in the timestamp. > Unless of course, its all an oscillation - bang, crunch, bang, crun

Re: python extra

2007-07-11 Thread Tina I
[EMAIL PROTECTED] wrote: > On Jul 8, 12:59?pm, Neal Becker <[EMAIL PROTECTED]> wrote: >> Just a little python humor: >> >> http://www.amazon.com/Vitamin-Shoppe-Python-Extra-tablets/dp/B00012NJ... > > Aren't there any female Python programmers? > No, of course not. Oh, and guys: If you take those

Re: profiling a C++ python extension

2007-07-11 Thread Gal Diskin
rasmus wrote: I have used gprof to profile stand alone C++ programs. I am also aware of pure python profilers. However, is there a way to get profile information on my C++ functions when they are compiled in a shared library (python extension module) and called from python. From what I can te

Python and Test Director

2007-07-11 Thread Lee, Solon
Hello, Can anyone tell me how to drive python test script via Test Director?? I am doing a project to translate Procomm script to python which is doable, but the purpose is so that the new .py scripts can be driven via Test Director. I am trying to research how to do it before this translatio

Re: stripping the first byte from a binary file

2007-07-11 Thread Stefan Behnel
Alex Popescu wrote: > Forgive my newbie ignorance, but I am wondering why the other method > would not work? I mean it may not be very safe, > but I guess it may perform a lot better, than having to read the whole > file just to cut out the first byte. Why would you expect that? It *might* perform

python and Test Director

2007-07-11 Thread solonlee
Hello, I have sent this similar email via another email address before I have registered with this email address, so the previous one may be rejected. I am sending agian via this newly established email address of mine. I am working on a project to translate Procomm to .py scripts, but the bu

Re: A clean way to program an interface

2007-07-11 Thread rh0dium
On Jul 9, 1:19 pm, rh0dium <[EMAIL PROTECTED]> wrote: Hi all, OK so I've started re-writing this based on the feedback you all gave me. How does this look? class Scanner: def __init__(self, *args, **kwargs): """description""" # Setup Logging self.log = logging.getLo

Re: bool behavior in Python 3000?

2007-07-11 Thread aaron . watters
On Jul 11, 3:37 am, Rob Wolfe <[EMAIL PROTECTED]> wrote: > > But `bools` are usefull in some contexts. Consider this: > > >>> 1 == 1 > True > >>> cmp(1, 1) > 0 > >>> 1 == 2 > False > >>> cmp(1, 2) > > -1 > > At first look you can see that `cmp` does not return boolean value > what not for all newbi

Re: Best architecture for proxy?

2007-07-11 Thread Andrew Warkentin
On Jul 10, 8:19 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann wrote: > > Andrew Warkentin wrote: > > >> I am going to write a general-purpose modular proxy in Python. It > >> will consist of a simple core and several modules for things like > >> filtering and caching. I am not s

Re: bool behavior in Python 3000?

2007-07-11 Thread Marc 'BlackJack' Rintsch
On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote: > Steven D'Aprano wrote: > >> From a purely functional perspective, bools are unnecessary in Python. I >> think of True and False as syntactic sugar. But they shouldn't be >> syntactic sugar for 1 and 0 any more than they should be syntactic su

Re: bool behavior in Python 3000?

2007-07-11 Thread Peter Otten
Steven D'Aprano wrote: > How could Python cast objects to bool before bool > existed? Time machine? Sorry, I couldn't resist. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > I mean, really, does anyone *expect* True+True to give 2, or that 2**True > even works, I may be biased since I learned C before Python and learned Python before it had a Boolean type, but I'd think that having False==0 and True==1 is not that surprising for m

Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Forgive my newbie ignorance, but I am wondering why the other method > > would not work? I mean it may not be very safe, > > but I guess it may perform a lot better, than having to read the whole > > file just to cut out the firs

wxPython vs. Tkinter event loops

2007-07-11 Thread Kevin Walzer
I'm porting a Tkinter application to wxPython and had a question about wxPython's event loop. The Tkinter app provides a GUI to a command-line tool. It gathers user input, and opens an asynchronous pipe to the external tool via os.popen(). Then, it dumps the output from the external process int

Re: bool behavior in Python 3000?

2007-07-11 Thread Stargaming
Alan Isaac schrieb: > Miles wrote: > >> What boolean operation does '-' represent? > > > Complementation. > And as usual, a-b is to be interpreted as a+(-b). > In which case the desired behavior is > False-True = False+(-True)=False+False = False I always thought, at least in a Python context,

Re: Best architecture for proxy?

2007-07-11 Thread Jean-Paul Calderone
On Wed, 11 Jul 2007 07:00:18 -0700, Andrew Warkentin <[EMAIL PROTECTED]> wrote: >On Jul 10, 8:19 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Bjoern Schliessmann wrote: >> > Andrew Warkentin wrote: >> >> >> I am going to write a general-purpose modular proxy in Python. It >> >> will consist of a

Re: bool behavior in Python 3000?

2007-07-11 Thread Rob Wolfe
Marc 'BlackJack' Rintsch wrote: > On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote: > > > Steven D'Aprano wrote: > > > >> From a purely functional perspective, bools are unnecessary in Python. I > >> think of True and False as syntactic sugar. But they shouldn't be > >> syntactic sugar for 1 an

Re: bool behavior in Python 3000?

2007-07-11 Thread Bruno Desthuilliers
Steven Bethard a écrit : (snip) > Remember that while Python 3 is allowed to break backwards > compatibility, it's only supposed to do it when there are concrete > benefits. Clearly there are existing use cases for treating bools like > ints, e.g. from Alexander Schmolck's email: > > (x < b

Re: wxPython vs. Tkinter event loops

2007-07-11 Thread Chris Mellon
On 7/11/07, Kevin Walzer <[EMAIL PROTECTED]> wrote: > I'm porting a Tkinter application to wxPython and had a question about > wxPython's event loop. > > The Tkinter app provides a GUI to a command-line tool. It gathers user > input, and opens an asynchronous pipe to the external tool via > os.pope

Re: Should I use Python for these programs?

2007-07-11 Thread Chris Mellon
On 7/10/07, CC <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann wrote: > > Grant Edwards wrote: > > > >>Most of the graphics I do with Python is with Gnuplot (not > >>really appropriate for what you want to do. > >>wxWidgets/Floatcanvas might be worth looking into. > > > > Agreed (I'm quite sure yo

Re: profiling a C++ python extension

2007-07-11 Thread Emin.shopper Martinian.shopper
Googling for "profiling python extensions" leads to the following link which worked for me a while ago: http://plexity.blogspot.com/2006/02/profiling-python-extensions.html On 7/10/07, rasmus <[EMAIL PROTECTED]> wrote: I have used gprof to profile stand alone C++ programs. I am also aware of p

Re: Passing a CookieJar instead of a cookieproc to urllib2.build_opener

2007-07-11 Thread [EMAIL PROTECTED]
On Jul 10, 11:10 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > urllib2.build_opener happily accepts and ignores a FileCookieJar.I > > had a bug in my code which looked like > > > urllib2.build_opener(func_returning_cookie_jar()) > > > which sho

Re: stripping the first byte from a binary file

2007-07-11 Thread Diez B. Roggisch
Alex Popescu wrote: > On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> > Forgive my newbie ignorance, but I am wondering why the other method >> > would not work? I mean it may not be very safe, >> > but I guess it may perform a lot better, than having to read the whole >> > fi

Re: wxPython vs. Tkinter event loops

2007-07-11 Thread star . public
On Jul 11, 11:17 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > No again. wxPython provides a Process class for executing external > applications and providing events in response to input, app exit, and > similar. You can also implement it in a similar way to your Tkinter > implementation, but ba

Problem with Python's "robots.txt" file parser in module robotparser

2007-07-11 Thread John Nagle
Python's "robots.txt" file parser may be misinterpreting a special case. Given a robots.txt file like this: User-agent: * Disallow: // Disallow: /account/registration Disallow: /account/mypro Disallow: /account/myint ... the python library "robo

Re: Simple search and Display system, no need for db?

2007-07-11 Thread flit
On Jul 11, 3:06 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > If the data is not too large, simple text files would do. Maybe in CSV > format. Either with building and department as columns in the files or > coded into the file name or path. That seems to be a good idea, but I am af

asyncore and OOB data

2007-07-11 Thread billiejoex
Hi there, In an asyncore based FTP server I wrote I should be able to receive OOB data from clients. A client sending such kind of data should act like this: >>> import socket >>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >>> s.connect(('127.0.0.1', 21)) >>> s.sendall('hello there\r\n'

Re: Simple search and Display system, no need for db?

2007-07-11 Thread Marc 'BlackJack' Rintsch
On Wed, 11 Jul 2007 16:52:32 +, flit wrote: > That seems to be a good idea, but I am afraid the web hosting does not > have the csv modules.. The `csv` module is part of the standard library. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread David Jones
On Jul 10, 12:47 am, "Jim Langston" <[EMAIL PROTECTED]> wrote: > "Paul Rubin" wrote in message > > news:[EMAIL PROTECTED] > > > "Jim Langston" <[EMAIL PROTECTED]> writes: > >> In Python 2.5 on intel, the statement > >> 2**2**2**2**2 > >> evaluates to > >> >>> 2**2**2**2**

Re: Embedding Matplotlib in wxpython wx.Panel problem

2007-07-11 Thread kyosohma
On Jul 10, 2:09 pm, abakshi11 <[EMAIL PROTECTED]> wrote: > I was wondering if you ever got to create a small GUI program that did plots > using Matplotlib > I am gettin an error where its saying "WXagg's accelerator requires the > wxPython headers-the wxpython header files can not be located in any

condor_compiled python interpreter

2007-07-11 Thread Thomas Nelson
Does anyone know where I could find help on condor_compiling a python interpreter? My own attempts have failed, and I can't find anything on google. Here's the condor page: http://www.cs.wisc.edu/condor/ Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: condor_compiled python interpreter

2007-07-11 Thread Will Maier
On Wed, Jul 11, 2007 at 10:28:52AM -0700, Thomas Nelson wrote: > Does anyone know where I could find help on condor_compiling a > python interpreter? My own attempts have failed, and I can't find > anything on google. This is probably more condor-related than Python-related, but are you building

Re: binascii.unhexlify ... not clear about usage, and output

2007-07-11 Thread [EMAIL PROTECTED]
On Jul 11, 3:21 am, Vishal <[EMAIL PROTECTED]> wrote: > On May 30, 1:31 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > > > > > > > Vishal wrote: > > > I have a file with a long list of hex characters, and I want to get a > > > file with corresponding binary characters > > > > here's what I did: > > >

Re: asyncore and OOB data

2007-07-11 Thread billiejoex
If it could be useful I attach the complete server application I used for doing tests: < code > import asyncore, asynchat, socket, os class Handler(asynchat.async_chat): def __init__(self, sock_obj): asynchat.async_chat.__init__(self, conn=sock_obj) self.remote_ip, self.remo

Re: bool behavior in Python 3000?

2007-07-11 Thread Ed Leafe
On Jul 11, 2007, at 2:04 AM, Stargaming wrote: > No, I think Bjoern just wanted to point out that all those binary > boolean operators already work *perfectly*. You just have to emphasize > that you're doing boolean algebra there, using `bool()`. > "Explicit is better than implicit." I th

Re: os.wait() losing child?

2007-07-11 Thread Jason Zheng
Greg, That explains it! Thanks a lot for your help. I guess this is something they do to prevent zombie threads? ~Jason greg wrote: > Jason Zheng wrote: >> Hate to reply to my own thread, but this is the working program that >> can demonstrate what I posted earlier: > > I've figured out what'

Tuple vs List: Whats the difference?

2007-07-11 Thread Shafik
Hello folks, I am an experienced programmer, but very new to python (2 days). I wanted to ask: what exactly is the difference between a tuple and a list? I'm sure there are some, but I can't seem to find a situation where I can use one but not the other. Thanks in advance, --Shafik -- http://ma

Re: Tuple vs List: Whats the difference?

2007-07-11 Thread Joe Riopel
On 7/11/07, Shafik <[EMAIL PROTECTED]> wrote: > I am an experienced programmer, but very new to python (2 days). I > wanted to ask: what exactly is the difference between a tuple and a > list? I'm sure there are some, but I can't seem to find a situation > where I can use one but not the other. Th

Re: os.wait() losing child?

2007-07-11 Thread Matthew Woodcraft
greg <[EMAIL PROTECTED]> wrote: > I've figured out what's going on. The Popen class has a > __del__ method which does a non-blocking wait of its own. > So you need to keep the Popen instance for each subprocess > alive until your wait call has cleaned it up. I don't think this will be enough for

Re: binascii.unhexlify ... not clear about usage, and output

2007-07-11 Thread Marc 'BlackJack' Rintsch
On Wed, 11 Jul 2007 10:46:23 -0700, [EMAIL PROTECTED] wrote: > You can with gmpy: > import gmpy x = 0x0164 s = gmpy.digits(x,2) # convert to base 2 y = '0'*(16-len(s)) + s # pad to 16 bits y > '000101100100' For the padding I'd use the `zfill()` method. In [1

Encode Bytes

2007-07-11 Thread albert_k_arhin
Hi All, I am new to python and I am using a strip down version of python that does not support struc,pack,etc. I have a binary protocol that is define as follows: PARTOffSet Lenght ID 02 VER 21 CMD 3

Re: os.wait() losing child?

2007-07-11 Thread Jason Zheng
greg wrote: > Jason Zheng wrote: >> Hate to reply to my own thread, but this is the working program that >> can demonstrate what I posted earlier: > > I've figured out what's going on. The Popen class has a > __del__ method which does a non-blocking wait of its own. > So you need to keep the Pope

Re: os.wait() losing child?

2007-07-11 Thread Jason Zheng
Matthew Woodcraft wrote: > greg <[EMAIL PROTECTED]> wrote: >> I've figured out what's going on. The Popen class has a >> __del__ method which does a non-blocking wait of its own. >> So you need to keep the Popen instance for each subprocess >> alive until your wait call has cleaned it up. > > I d

Re: Tuple vs List: Whats the difference?

2007-07-11 Thread Alexander Schmolck
Shafik <[EMAIL PROTECTED]> writes: > Hello folks, > > I am an experienced programmer, but very new to python (2 days). I > wanted to ask: what exactly is the difference between a tuple and a > list? I'm sure there are some, but I can't seem to find a situation > where I can use one but not the oth

Re: Tuple vs List: Whats the difference?

2007-07-11 Thread Shafik
On Jul 11, 12:05 pm, Alexander Schmolck <[EMAIL PROTECTED]> wrote: > Shafik <[EMAIL PROTECTED]> writes: > > Hello folks, > > > I am an experienced programmer, but very new to python (2 days). I > > wanted to ask: what exactly is the difference between a tuple and a > > list? I'm sure there are some

lists and dictionaries

2007-07-11 Thread Ladislav Andel
Hi, I have a list of dictionaries. e.g. [{'index': 0, 'transport': 'udp', 'service_domain': 'dp0.example.com'}, {'index': 1, 'transport': 'udp', 'service_domain': 'dp1.example.com'}, {'index': 0, 'transport': 'tcp', 'service_domain': 'dp0.example.com'}, {'index': 1, 'transport': 'tcp', 'service_dom

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Paul McGuire
On Jul 11, 12:04 pm, David Jones <[EMAIL PROTECTED]> wrote: > > In fact, if I put (2**2)**2**2**2 > > it comes up with the correct answer, 4294967296 > > Actually, the "correct" answer (even by your own demonstration) is > 65536. It might be easier to demonstrate if we chose a less homogeneous pro

Re: lists and dictionaries

2007-07-11 Thread [EMAIL PROTECTED]
On Jul 11, 12:08 pm, Ladislav Andel <[EMAIL PROTECTED]> wrote: > Hi, > I have a list of dictionaries. > e.g. > [{'index': 0, 'transport': 'udp', 'service_domain': 'dp0.example.com'}, > {'index': 1, 'transport': 'udp', 'service_domain': 'dp1.example.com'}, > {'index': 0, 'transport': 'tcp', 'service

Re: ImportError: MemoryLoadLibrary failed loading

2007-07-11 Thread kyosohma
On Jul 9, 12:47 pm, [EMAIL PROTECTED] wrote: > Hi, > > Recently I began my journey into creating executables. I am using > Andrea > Gavana's cool GUI2EXE program which works very well and that is a GUI > for > py2ece. I am also using Inno Setup to create a script/executable. > Anyway, > today I am

Re: os.wait() losing child?

2007-07-11 Thread Nick Craig-Wood
Jason Zheng <[EMAIL PROTECTED]> wrote: > greg wrote: > > Jason Zheng wrote: > >> Hate to reply to my own thread, but this is the working program that > >> can demonstrate what I posted earlier: > > > > I've figured out what's going on. The Popen class has a > > __del__ method which does a non-bl

Re: bool behavior in Python 3000?

2007-07-11 Thread Nick Craig-Wood
Alan Isaac <[EMAIL PROTECTED]> wrote: > Miles wrote: > > What boolean operation does '-' represent? > > Complementation. > And as usual, a-b is to be interpreted as a+(-b). > In which case the desired behavior is > False-True = False+(-True)=False+False = False If you want to do algebra wit

Re: storing pickles in sql data base

2007-07-11 Thread Nick Craig-Wood
David Bear <[EMAIL PROTECTED]> wrote: > I need to store pickled objects in postgresql. I reading through the pickle > docs it says to always open a file in binary mode because you can't be sure > if the pickled data is binary or text. So I have 2 question. Can I set the > pickle to be text -- a

Re: binascii.unhexlify ... not clear about usage, and output

2007-07-11 Thread [EMAIL PROTECTED]
On Jul 11, 1:38 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007 10:46:23 -0700, [EMAIL PROTECTED] wrote: > > You can with gmpy: > > import gmpy > x = 0x0164 > s = gmpy.digits(x,2) # convert to base 2 > y = '0'*(16-len(s)) + s # pad to 16 bits

Re: Problem with Python's "robots.txt" file parser in module robotparser

2007-07-11 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: >Python's "robots.txt" file parser may be misinterpreting a > special case. Given a robots.txt file like this: > > User-agent: * > Disallow: // > Disallow: /account/registration > Disallow: /accoun

C Python Network Performance

2007-07-11 Thread GM M
Hello, I am writing an application bulk of which is sending and receving UDP data. I was evaluating which language will be a better fit for the job. I wrote following small pieces of code in Python and C respectively: from socket import * import sys if __name__ == '__main__': s = socket(AF

RE: S2K DTS and Python

2007-07-11 Thread Phil Runciman
-Original Message- From: Tim Golden [mailto:[EMAIL PROTECTED] Sent: Tuesday, 10 July 2007 7:58 p.m. Cc: python-list@python.org Subject: Re: S2K DTS and Python Phil Runciman wrote: > I am a Python newbie so please be gentle on me. Tim G

RE: S2K DTS and Python

2007-07-11 Thread Phil Runciman
-Original Message- From: stefaan [mailto:[EMAIL PROTECTED] Sent: Wednesday, 11 July 2007 6:47 a.m. To: python-list@python.org Subject: Re: S2K DTS and Python > > However, I now want to update some tables in MSAccess, and it occurred

Re: bool behavior in Python 3000?

2007-07-11 Thread Terry Reedy
"Ed Leafe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I think that the assignability to the names 'True' and 'False' is | incorrect, or at the very least subject to all sorts of odd results. It is necessary for 2.x to not break older code. I believe they will somehow be rese

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Evan Klitzke
On 7/11/07, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 11, 12:04 pm, David Jones <[EMAIL PROTECTED]> wrote: > > > In fact, if I put (2**2)**2**2**2 > > > it comes up with the correct answer, 4294967296 > > > > Actually, the "correct" answer (even by your own demonstration) is > > 65536. > > I

Re: asyncore and OOB data

2007-07-11 Thread Douglas Wells
In article <[EMAIL PROTECTED]>, billiejoex <[EMAIL PROTECTED]> writes: > In an asyncore based FTP server I wrote I should be able to receive > OOB data from clients. > A client sending such kind of data should act like this: > > >>> import socket > >>> s = socket.socket(socket.AF_INET, socket.SOC

Re: Encode Bytes

2007-07-11 Thread John Machin
On Jul 12, 4:40 am, "albert_k_arhin" <[EMAIL PROTECTED]> wrote: > Hi All, > I am new to python and I am using a strip down version of > python that does not support struc,pack,etc. > > I have a binary protocol that is define as follows: > > PARTOffSet Lenght > ==

Re: pattern match !

2007-07-11 Thread Jay Loden
Helmut Jarausch wrote: > [EMAIL PROTECTED] wrote: >> Extract the application name with version from an RPM string like >> hpsmh-1.1.1.2-0-RHEL3-Linux.RPM, i require to extract hpsmh-1.1.1.2-0 >> from above string. Sometimes the RPM string may be hpsmh-1.1.1.2-RHEL3- >> Linux.RPM. >> > > Have a tr

Direct Client - Sr.Soft Engineer-Python and Linux

2007-07-11 Thread Kan
Hello, We have requirement for Sr.Software Engineer in San Jose CA with very strong experinece in PYTHON AND LINUX . If your skills and experience matches with the same, send me your resume asap with contact # and rate. Locals only pls apply The details of the openings are:- Strong in Python an

Direct Client - Sr.Soft Engineer-Python and Linux

2007-07-11 Thread Kan
Hello, We have requirement for Sr.Software Engineer in San Jose CA with very strong experinece in PYTHON AND LINUX . If your skills and experience matches with the same, send me your resume asap with contact # and rate. Locals only pls apply The details of the openings are:- Strong in Python an

Re: win32com ppt embedded object - SOLVED

2007-07-11 Thread Lance Hoffmeyer
Basically, if I ran (after discovering what the object name I was trying to modify in the ppt slide was): if WB.Slides(29).Shapes("Object 2").Type==7: PWB = WB.Slides(29).Shapes("Object 2") #Select the Graph Object oGraph = PWB.OLEFormat.Object

Re: 2**2**2**2**2 wrong? Bug?

2007-07-11 Thread Paul Rubin
"Evan Klitzke" <[EMAIL PROTECTED]> writes: > Python happens to choose right > associativity for exponentiation because it is more useful for that > operator, but that doesn't make the language itself right associative. I would say Python uses right associativity for exponentiation because that's s

Re: Portable general timestamp format, not 2038-limited

2007-07-11 Thread Ilya Zakharevich
[A complimentary Cc of this posting was sent to Martin Gregorie <[EMAIL PROTECTED]>], who wrote in article <[EMAIL PROTECTED]>: > >> Its in "A Short History of Time". Sorry I can't quote chapter or page, > >> but a friend borrowed my copy and lent me Dawkins "Climbing Mount > >> Improbable" befo

RE: Time A Script

2007-07-11 Thread Adam Pletcher
Try: --- import time start_time = time.time() run_time = time.time() - start_time print 'Run time: %f seconds' % run_time --- Also have a look at the timeit module for more timing functionality. - Adam From: [EMAIL PROTECTED] [mailto:[EMAIL PROT

Re: storing pickles in sql data base

2007-07-11 Thread Chris Mellon
On 7/11/07, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > David Bear <[EMAIL PROTECTED]> wrote: > > I need to store pickled objects in postgresql. I reading through the pickle > > docs it says to always open a file in binary mode because you can't be sure > > if the pickled data is binary or text

Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 7:45 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alex Popescu wrote: > > On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> > Forgive my newbie ignorance, but I am wondering why the other method > >> > would not work? I mean it may not be very safe, > >> > but

  1   2   >