Re: Symbols as parameters?

2010-01-29 Thread Roald de Vries
On Jan 29, 2010, at 2:30 AM, Steven D'Aprano wrote: On Thu, 28 Jan 2010 17:01:38 +0100, Roald de Vries wrote: Question out of general interest in the language: If I would want to generate such functions in a for-loop, what would I have to do? This doesn't work: class Move(object): def

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Python has had > previous major changes in the past (e.g. 1.5 to 2.0 and 2.1 to 2.2) and > hardly anyone made a complaint. I think this is actually false for the switch from 1.5 to 2.0. People complained a lot, and announced that they won't switch to Python 2 in any foreseeable future, and ind

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Well, I'd consider that an official release. Note that I didn't claim > there was no hope PSF wouldn't change it's mind on 2.8. I'd like to point out that the PSF formally doesn't have any say in this. Instead, releases are created by the release manager, who gets appointed by Guido van Rossum

Re: Why doesn't "filterwarnings" suppress this message?

2010-01-29 Thread John Nagle
It turned out to be a loading order issue. That message is generated at import time, and "filterwarnings" hadn't been called yet. John Nagle Peter Otten wrote: John Nagle wrote: Feedparser isn't supported for Python 3.0, so in Python 2.6, many

Re: myths about python 3

2010-01-29 Thread Martin v. Loewis
> Why do I feel like there's less of an onus on Unladen Swallow to > _actually prove itself in substantial real world usage_ before > integration into CPython than there is on even the smallest of modules > for inclusion in the standard library? Because it's a VM change, not an end-user change. VM

Re: mix statically typed with dynamically typed

2010-01-29 Thread John Nagle
Yingjie Lan wrote: We all know that Python is dynamically typed, and dynamically typed languages are generally slower than statically typed ones. That's mostly a problem with the CPython interpreter, which is a naive interpreter. Many dynamically typed languages have implementations which

Killing a Thread

2010-01-29 Thread Richard Lamboj
Hello, which Method is better to kill a Thread? Using Thread Events, or a raising a Exception? Maybe someone has a small example for me? Kind Regards, Richi -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 28 ene, 23:36, Jonathan Gardner wrote: > On Jan 28, 2:16 pm, Joan Miller wrote: > > > > > There would be to make a function for each system command to use so it > > would be too inefficient, and follow the problem with the quotes. > > > The best is make a parser into a compiled language > > Ye

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 28 ene, 22:57, John Posner wrote: > On 1/28/2010 3:45 PM, Joan Miller wrote: > > > > > On 28 ene, 20:34, Joan Miller  wrote: > >> On 28 ene, 20:20, Peter  wrote: > > >>> On Jan 29, 6:58 am, John Posner  wrote: > > On 1/28/2010 2:24 PM, Joan Miller wrote: > > > On 28 ene, 19:16, Josh Ho

which one is faster?

2010-01-29 Thread Stephen.Wu
str.find(targetStr) str.index(targetStr) with exception str.count(targetStr) targetStr in str which is the fastest way to check whether targetStr is in str? thanks all -- http://mail.python.org/mailman/listinfo/python-list

Re: myths about python 3

2010-01-29 Thread Ben Finney
Steven D'Aprano writes: > On Fri, 29 Jan 2010 08:33:58 +1100, Ben Finney wrote: > > Perhaps Steven could tell you about a lovely Australian meaning for > > the word “date”. > > This is a family list, so perhaps I shouldn't. :) > > In Australia slang, "date" is short for "date hole", which is the

Re: myths about python 3

2010-01-29 Thread Ben Finney
"Martin v. Loewis" writes: > Not being interested in the PEP process is your choice, of course, but > you shouldn't complain afterwards that your opinion wasn't considered > if you didn't actually voice it appropriately. +1 QOTW -- \“I installed a skylight in my apartment. The people

Re: Sorting a list with entries of unequal types

2010-01-29 Thread Peter Otten
Ben Finney wrote: > Peter Otten <__pete...@web.de> writes: > >> I can't find the relevant part of the 2.6 documentation, but something >> like >> >> >>> def key(x): >> ... t = type(x) >> ... t = compat.get(t, t) >> ... return t.__name__, id(t), x >> ... >> >>> compat = {bool: float, i

Re: Wrap a function

2010-01-29 Thread Joan Miller
On 29 ene, 05:44, Dennis Lee Bieber wrote: > On Thu, 28 Jan 2010 11:24:28 -0800 (PST), Joan Miller > declaimed the following in > gmane.comp.python.general: > > > On 28 ene, 19:16, Josh Holland wrote: > > > On 2010-01-28, Joan Miller wrote: > > > > > I've to call to many functions with the form

Re: Python-list Digest, Vol 76, Issue 303

2010-01-29 Thread siddhartha veedaluru
Hi, Thats the output i got in output window.it is not listing the statement which caused it. copy paste and try it on you setup. it behaves the same way. I know that error is in log.info() function call.but it is not caught by "except". which is not getting logged using log.exception Thanks Sidd

Re: TypeError not caught by except statement

2010-01-29 Thread siddhartha veedaluru
Hi, Thats the output i got in output window.it is not listing the statement which caused it. copy paste and try it on you setup. it behaves the same way. I know that error is in log.info() function call.but it is not caught by "except". which is not getting logged using log.exception Thanks Sidd

Re: Need help with a program

2010-01-29 Thread Johann Spies
On Thu, Jan 28, 2010 at 07:07:04AM -0800, evilweasel wrote: > Hi folks, > > I am a newbie to python, and I would be grateful if someone could > point out the mistake in my program. Basically, I have a huge text > file similar to the format below: > > AGACTCGAGTGCGCGGA 0 > AGATAAGCTAATTAAG

Re: Need help with a program

2010-01-29 Thread Steven D'Aprano
On Fri, 29 Jan 2010 11:23:54 +0200, Johann Spies wrote: > On Thu, Jan 28, 2010 at 07:07:04AM -0800, evilweasel wrote: >> Hi folks, >> >> I am a newbie to python, and I would be grateful if someone could point >> out the mistake in my program. Basically, I have a huge text file >> similar to the f

Re: which one is faster?

2010-01-29 Thread Bruno Desthuilliers
alex23 a écrit : On Jan 29, 4:29 pm, "Stephen.Wu" <54wut...@gmail.com> wrote: str.find(targetStr) str.index(targetStr) with exception str.count(targetStr) targetStr in str which is the fastest way to check whether targetStr is in str? It's generally a lot quicker to investigate this kind of q

Thread get off from CPU occasionally. I suspect.

2010-01-29 Thread Rajat
Hi, I'm using Python 2.6 and using the threading module. In a python module (parent module) I'm importing main() function from another python module. I'm runnin this main() function on a Python thread so that I can periodically check in the parent thread/module if the new thread is up and running.

Re: which one is faster?

2010-01-29 Thread Antoine Pitrou
Le Thu, 28 Jan 2010 22:39:32 -0800, alex23 a écrit : > On Jan 29, 4:29 pm, "Stephen.Wu" <54wut...@gmail.com> wrote: >> str.find(targetStr) >> str.index(targetStr) with exception >> str.count(targetStr) >> targetStr in str >> >> which is the fastest way to check whether targetStr is in str? > [...]

Re: python 3's adoption

2010-01-29 Thread Steven D'Aprano
On Fri, 29 Jan 2010 07:10:01 +0100, Alf P. Steinbach wrote: >>>> L = ["æ", "ø", "å"] # This is in SORTED ORDER in Norwegian L [...] >>>> L.sort( key = locale.strxfrm ) >>>> L >['å', 'æ', 'ø'] >>>> locale.strcoll( "å", "æ" ) >1 >>>> locale.strcoll( "æ", "ø" ) >-1

Re: [OT] Perl 6 [was Re: myths about python 3]

2010-01-29 Thread Grant Edwards
On 2010-01-29, Neil Hodgson wrote: > Looks to me like the problem with Perl 6 was that it was too > ambitious, wanting to fix all perceived problems with the > language. I thought Python was Perl with all the perceived problems fixed. -- Grant -- http://mail.python.org/mailman/listinfo/pytho

[OT] myths about python 3

2010-01-29 Thread Antoine Pitrou
Le Fri, 29 Jan 2010 13:16:11 +1100, Ben Finney a écrit : > > I think the reason “date” was initially used is because dates are most > familiar to us as fleshy, dark brown, wrinkled, compressed points. > > My interests in etymology and scatology unite here. Ah, I suppose it explains the strange A

Re: myths about python 3

2010-01-29 Thread Anssi Saari
Stefan Behnel writes: > 'Stable Debian' has a long tradition of being late and outdated on arrival. > That doesn't mean you can't use existing Debian packages on it. Yes, but that's beside the point. No released version of Debian ships with Python3 or even 2.6. Oh, and RHEL5 and CentOS5 ship wi

Re: myths about python 3

2010-01-29 Thread Anssi Saari
Daniel Fetchinson writes: >> 1. Python 3 is supported by major Linux distributions. >> >> FALSE - most distros are shipping with Python 2.4, or 2.5 at best. > > This latter statement is false, Fedora 11 and 12 come with python 2.6. How does your mention of one distro counter that claim? Pe

Re: Need help with a program

2010-01-29 Thread Johann Spies
On Fri, Jan 29, 2010 at 10:04:33AM +, Steven D'Aprano wrote: > > I know this is a python list but if you really want to get the job done > > quickly this is one method without writing python code: > > > > $ cat /tmp/y > > AGACTCGAGTGCGCGGA 0 > > AGATAAGCTAATTAAGCTACTGG 0 > >

Function name unchanged in error message

2010-01-29 Thread andrew cooke
Is there any way to change the name of the function in an error message? In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like the wrapper function to give the same name) >>> def foo(): ... return 7 ... >>> foo.__name

Re: Function name unchanged in error message

2010-01-29 Thread Jean-Michel Pichavant
andrew cooke wrote: Is there any way to change the name of the function in an error message? In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like the wrapper function to give the same name) def foo(): ...

Re: myths about python 3

2010-01-29 Thread Duncan Booth
Anssi Saari wrote: > Daniel Fetchinson writes: > >>> 1. Python 3 is supported by major Linux distributions. >>> >>> FALSE - most distros are shipping with Python 2.4, or 2.5 at best. >> >> This latter statement is false, Fedora 11 and 12 come with python 2.6. > > How does your mention of

Re: myths about python 3

2010-01-29 Thread Benjamin Kaplan
On Fri, Jan 29, 2010 at 8:13 AM, Anssi Saari wrote: > Daniel Fetchinson writes: > >>> 1.  Python 3 is supported by major Linux distributions. >>> >>>      FALSE - most distros are shipping with Python 2.4, or 2.5 at best. >> >> This latter statement is false, Fedora 11 and 12 come with python 2.6

Re: python 3's adoption

2010-01-29 Thread Duncan Booth
Steven D'Aprano wrote: > If that's too verbose for you, stick this as a helper function in your > application: > > > def CmpToKey(mycmp): > 'Convert a cmp= function into a key= function' > class K(object): > def __init__(self, obj, *args): > self.obj = obj >

Re: Function name unchanged in error message

2010-01-29 Thread Chris Rebert
On Fri, Jan 29, 2010 at 5:30 AM, andrew cooke wrote: > Is there any way to change the name of the function in an error > message?  In the example below I'd like the error to refer to bar(), > for example (the motivation is related function decorators - I'd like > the wrapper function to give the s

Python 3.1 simplejson install

2010-01-29 Thread dirknbr
I am trying to install simplejson on Python 3.1 on Windows. When I do 'python setup.py install' I get 'except DisutilsPlatformError, x: SyntaxError' with a dash under the comma. Any ideas? Dirk -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with a program

2010-01-29 Thread D'Arcy J.M. Cain
On Fri, 29 Jan 2010 11:23:54 +0200 Johann Spies wrote: > I know this is a python list but if you really want to get the job > done quickly this is one method without writing python code: > [...] > $ grep -v 0 /tmp/y > tmp/z There's plenty of ways to do it without writing Python. C, C++, Perl, Fo

Re: Function name unchanged in error message

2010-01-29 Thread Peter Otten
andrew cooke wrote: > Is there any way to change the name of the function in an error > message? In the example below I'd like the error to refer to bar(), > for example (the motivation is related function decorators - I'd like > the wrapper function to give the same name) > def foo(): > ..

Re: Python 3.1 simplejson install

2010-01-29 Thread Peter Otten
dirknbr wrote: > I am trying to install simplejson on Python 3.1 on Windows. When I do > 'python setup.py install' I get 'except DisutilsPlatformError, x: > SyntaxError' with a dash under the comma. You are trying to install a package written for Python 2.x on 3.x, and some of the 2.x Syntax is

Some C-API functions clear the error indicator?

2010-01-29 Thread Austin Bingham
I've noticed that several (many?) python functions seem to clear the error/exception indicators when they're called from a C/C++ program. For example, both PyImport_ImportModule and traceback.extract_tb() (called via the function call methods) do this: if error indicators are set prior to their cal

Re: Python 3.1 simplejson install

2010-01-29 Thread Christian Heimes
dirknbr wrote: > I am trying to install simplejson on Python 3.1 on Windows. When I do > 'python setup.py install' I get 'except DisutilsPlatformError, x: > SyntaxError' with a dash under the comma. There is no need to install simplejson yourself. Python 3 and 2.6 already have a JSON package calle

Re: Python 3.1 simplejson install

2010-01-29 Thread Chris Rebert
On Fri, Jan 29, 2010 at 6:33 AM, Peter Otten <__pete...@web.de> wrote: > dirknbr wrote: >> I am trying to install simplejson on Python 3.1 on Windows. When I do >> 'python setup.py install' I get 'except DisutilsPlatformError, x: >> SyntaxError' with a dash under the comma. > > You are trying to in

Re: Need help with a program

2010-01-29 Thread nn
Johann Spies wrote: > On Thu, Jan 28, 2010 at 07:07:04AM -0800, evilweasel wrote: > > Hi folks, > > > > I am a newbie to python, and I would be grateful if someone could > > point out the mistake in my program. Basically, I have a huge text > > file similar to the format below: > > > > AGACTC

Re: Function name unchanged in error message

2010-01-29 Thread exarkun
On 02:10 pm, c...@rebertia.com wrote: On Fri, Jan 29, 2010 at 5:30 AM, andrew cooke wrote: Is there any way to change the name of the function in an error message? �In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like t

Re: Some C-API functions clear the error indicator?

2010-01-29 Thread Duncan Booth
Austin Bingham wrote: > The functions that do this don't seem to indicate in their > documentation that this will happen. So first, does anyone know why > this is happening? Is it because of the context in which I'm making > the calls? Is there any pattern or reason behind which functions will >

Funny behaviour with __future__ and doctest between 2.6 and 3.1

2010-01-29 Thread Mattsteel
Hello all. I'm using Python 2.6.4 and Python 3.1.1. My wish is to code in a 3.1-compliant way using 2.6, so I'm importing the __future__ module. I've found a funny thing comparing the two folliwing snippets that differ for one line only, that is the position of __future__ import (before or after th

Re: python 3's adoption

2010-01-29 Thread Paul Boddie
On 29 Jan, 06:56, Terry Reedy wrote: > On 1/28/2010 6:47 PM, Paul Boddie wrote: > > > What would annoy me if I used Python 3.x would be the apparent lack of > > the __cmp__ method for conveniently defining comparisons between > > instances of my own classes. Having to define all the rich compariso

Re: python 3's adoption

2010-01-29 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 29 Jan 2010 07:10:01 +0100, Alf P. Steinbach wrote: >>> L = ["æ", "ø", "å"] # This is in SORTED ORDER in Norwegian L [...] >>> L.sort( key = locale.strxfrm ) >>> L ['å', 'æ', 'ø'] >>> locale.strcoll( "å", "æ" ) 1 >>> locale.strcoll( "æ", "ø"

Re: myths about python 3

2010-01-29 Thread eric_dex...@msn.com
On Jan 27, 2:56 pm, John Nagle wrote: > Daniel Fetchinson wrote: > > Hi folks, > > > I was going to write this post for a while because all sorts of myths > > periodically come up on this list about python 3. I don't think the > > posters mean to spread false information on purpose, they simply ar

Re: Funny behaviour with __future__ and doctest between 2.6 and 3.1

2010-01-29 Thread Peter Otten
Mattsteel wrote: > Hello all. > I'm using Python 2.6.4 and Python 3.1.1. > My wish is to code in a 3.1-compliant way using 2.6, so I'm importing > the __future__ module. > I've found a funny thing comparing the two folliwing snippets that > differ for one line only, that is the position of __futur

SimpleXMLRPCServer daemon

2010-01-29 Thread Thomas Allen
I have a script that runs an instance of SimpleXMLRPCServer and in general it works as expected. In its __del__, it is supposed to clean up its PID file (written on boot). I have two problems with this server instance: The first is that tt doesn't always clean up its PID file; is there a more relia

Re: SimpleXMLRPCServer daemon

2010-01-29 Thread Adam Tauno Williams
On Fri, 2010-01-29 at 07:54 -0800, Thomas Allen wrote: > I have a script that runs an instance of SimpleXMLRPCServer and in > general it works as expected. In its __del__, it is supposed to clean > up its PID file (written on boot). I have two problems with this > server instance: The first is that

Re: Function name unchanged in error message

2010-01-29 Thread Michele Simionato
On Jan 29, 2:30 pm, andrew cooke wrote: > Is there any way to change the name of the function in an error > message?  In the example below I'd like the error to refer to bar(), > for example (the motivation is related function decorators - I'd like > the wrapper function to give the same name) Us

Re: Funny behaviour with __future__ and doctest between 2.6 and 3.1

2010-01-29 Thread Mattsteel
Hi Peter. Sadly (for me), you're right... then the only way to use doctest to work both in 2.6 and 3.1 (without modifications between them) is something like this: #!/usr/bin/env python ''' >>> str(concat('hello','world')) 'hello world' ''' from __future__ import unicode_literals def concat( firs

Re: Funny behaviour with __future__ and doctest between 2.6 and 3.1

2010-01-29 Thread Peter Otten
Mattsteel wrote: > Sadly (for me), you're right... then the only way to use doctest to > work both in 2.6 and 3.1 (without modifications between them) is > something like this: > > #!/usr/bin/env python > ''' str(concat('hello','world')) > 'hello world' > ''' > from __future__ import unicod

Re: SimpleXMLRPCServer daemon

2010-01-29 Thread Tim Wintle
On Fri, 2010-01-29 at 07:54 -0800, Thomas Allen wrote: > The second is that when it does crash, I don't know about it...what > would be sufficient as a "keep-alive" script to restart it? I suppose > I could use something like EventMachine (already installed on my > server) to watch the PID file if

Threading issue with SQLite

2010-01-29 Thread Alan Harris-Reid
Hi, I am creating a web application (using Python 3.1 and CherryPy 3.2) where a SQLite connection and cursor object are created using the following code (simplified from the original): class MainSite: con = sqlite.connect('MyDatabase.db') cursor = con.cursor() def index_page():

Keyboard input

2010-01-29 Thread Mr.SpOOn
Hi, I need to get keyboard input in a python program. I need it to let the user choose some options, for example: 1) option 1 2) option 2 3) option 3 and then to input some data to the program. I'm using the raw_input method and it works fine, but I noted that I can't use backspace and when I ac

get PyObject* knowing its string name

2010-01-29 Thread Mr.M
I think this sounds like a stupid question, but I searched the C/Api doc and google but I wasn't able to find any hint: how can I retrive PyObject pointer if I only know it's name? What I'd like to do is something like this: [code] PyObject* obj = PyFindWhatImLookingFor("w.z.y.x"); [/code] Of

Re: Sleep timer but still responsive?

2010-01-29 Thread JohnnyFive
On Jan 28, 4:55 pm, "Gabriel Genellina" wrote: > Please provide more details. What do you want your program to do while   > sleeping? What kind of actions do you want a response to? > Do you have a GUI? A curses-based interfase? > > -- > Gabriel Genellina My app is purely console based. I just do

Re: get PyObject* knowing its string name

2010-01-29 Thread Robert Kern
On 2010-01-29 11:00 AM, Mr.M wrote: I think this sounds like a stupid question, but I searched the C/Api doc and google but I wasn't able to find any hint: how can I retrive PyObject pointer if I only know it's name? What I'd like to do is something like this: [code] PyObject* obj = PyFindWhat

Processing XML File

2010-01-29 Thread jakecjacobson
I need to take a XML web resource and split it up into smaller XML files. I am able to retrieve the web resource but I can't find any good XML examples. I am just learning Python so forgive me if this question has been answered many times in the past. My resource is like: ... ...

Changing tab behavior in Python Interactive mode

2010-01-29 Thread Andrej Mitrovic
I've noticed that when running Python in interactive mode (via cmd on windows), the first time I hit tab it will move 4 spaces to the right, however each new tab will move 8 spaces instead of 4. Why this inconsistent behavior? And how could I change this to be consistent and always move only 4 spac

Re: Sleep timer but still responsive?

2010-01-29 Thread MRAB
JohnnyFive wrote: On Jan 28, 4:55 pm, "Gabriel Genellina" wrote: Please provide more details. What do you want your program to do while sleeping? What kind of actions do you want a response to? Do you have a GUI? A curses-based interfase? -- Gabriel Genellina My app is purely console based

Re: Changing tab behavior in Python Interactive mode

2010-01-29 Thread Steve Holden
Andrej Mitrovic wrote: > I've noticed that when running Python in interactive mode (via cmd on > windows), the first time I hit tab it will move 4 spaces to the right, > however each new tab will move 8 spaces instead of 4. Why this > inconsistent behavior? And how could I change this to be consist

RE: Sleep timer but still responsive?

2010-01-29 Thread Andreas Tawn
> On Jan 28, 4:55 pm, "Gabriel Genellina" > wrote: > > Please provide more details. What do you want your program to do > while > > sleeping? What kind of actions do you want a response to? > > Do you have a GUI? A curses-based interfase? > > > > -- > > Gabriel Genellina > > My app is purely cons

Re: Processing XML File

2010-01-29 Thread Adam Tauno Williams
On Fri, 2010-01-29 at 09:25 -0800, jakecjacobson wrote: > I need to take a XML web resource and split it up into smaller XML > files. I am able to retrieve the web resource but I can't find any > good XML examples. I am just learning Python so forgive me if this > question has been answered many

Re: Sleep timer but still responsive?

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 14:39:31 -0300, MRAB escribió: JohnnyFive wrote: My app is purely console based. I just don't want the console to lock up (on Windows using time.sleep(x) causes the console to become unresponsive until the timer is done), and I want people to be able to CTRL+C to stop th

Re: Sleep timer but still responsive?

2010-01-29 Thread JohnnyFive
On Jan 29, 9:33 am, Andreas Tawn wrote: > > On Jan 28, 4:55 pm, "Gabriel Genellina" > > wrote: > > > Please provide more details. What do you want your program to do > > while > > > sleeping? What kind of actions do you want a response to? > > > Do you have a GUI? A curses-based interfase? > > >

Re: Processing XML File

2010-01-29 Thread jakecjacobson
On Jan 29, 1:04 pm, Adam Tauno Williams wrote: > On Fri, 2010-01-29 at 09:25 -0800, jakecjacobson wrote: > > I need to take a XML web resource and split it up into smaller XML > > files.  I am able to retrieve the web resource but I can't find any > > good XML examples.  I am just learning Python

Re: Processing XML File

2010-01-29 Thread Adam Tauno Williams
On Fri, 2010-01-29 at 10:34 -0800, jakecjacobson wrote: > On Jan 29, 1:04 pm, Adam Tauno Williams > wrote: > > On Fri, 2010-01-29 at 09:25 -0800, jakecjacobson wrote: > > > I need to take a XML web resource and split it up into smaller XML > > > files. I am able to retrieve the web resource but I

Re: Processing XML File

2010-01-29 Thread Stefan Behnel
jakecjacobson, 29.01.2010 18:25: > I need to take a XML web resource and split it up into smaller XML > files. I am able to retrieve the web resource but I can't find any > good XML examples. I am just learning Python so forgive me if this > question has been answered many times in the past. > >

RE: Processing XML File

2010-01-29 Thread Sells, Fred
Google is your friend. Elementtree is one of the better documented IMHO, but there are many modules to do this. > -Original Message- > From: python-list-bounces+frsells=adventistcare@python.org > [mailto:python-list-bounces+frsells=adventistcare@python.org] On > Behalf Of Stefan B

Re: Processing XML File

2010-01-29 Thread Stefan Behnel
Sells, Fred, 29.01.2010 20:31: > Google is your friend. Elementtree is one of the better documented > IMHO, but there are many modules to do this. Unless the OP provides some more information, "do this" is rather underdefined. And sending someone off to Google who is just learning the basics of P

Re: Some C-API functions clear the error indicator?

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 11:37:09 -0300, Austin Bingham escribió: I've noticed that several (many?) python functions seem to clear the error/exception indicators when they're called from a C/C++ program. For example, both PyImport_ImportModule and traceback.extract_tb() (called via the function ca

Re: SimpleXMLRPCServer daemon

2010-01-29 Thread Sean DiZazzo
On Jan 29, 7:54 am, Thomas Allen wrote: > I have a script that runs an instance of SimpleXMLRPCServer and in > general it works as expected. In its __del__, it is supposed to clean > up its PID file (written on boot). I have two problems with this > server instance: The first is that tt doesn't al

Re: site.py confusion

2010-01-29 Thread Gabriel Genellina
En Wed, 27 Jan 2010 15:48:23 -0300, George Trojan escribió: Arnaud Delobelle wrote: George Trojan writes: Inspired by the 'Default path for files' thread I tried to use sitecustomize in my code. What puzzles me is that the site.py's main() is not executed. My sitecustomize.py is That gave

Re: SimpleXMLRPCServer daemon

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 12:54:23 -0300, Thomas Allen escribió: I have a script that runs an instance of SimpleXMLRPCServer and in general it works as expected. In its __del__, it is supposed to clean up its PID file (written on boot). I have two problems with this server instance: The first is th

Re: Function name unchanged in error message

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato escribió: On Jan 29, 2:30 pm, andrew cooke wrote: Is there any way to change the name of the function in an error message? In the example below I'd like the error to refer to bar(), for example (the motivation is related function decora

Re: Changing tab behavior in Python Interactive mode

2010-01-29 Thread Andrej Mitrovic
On Jan 29, 6:47 pm, Steve Holden wrote: > Andrej Mitrovic wrote: > > I've noticed that when running Python in interactive mode (via cmd on > > windows), the first time I hit tab it will move 4 spaces to the right, > > however each new tab will move 8 spaces instead of 4. Why this > > inconsistent

Re: python for net manager

2010-01-29 Thread Gabriel Genellina
En Wed, 27 Jan 2010 00:11:10 -0300, moon sky escribió: i just want to write a small tool to manage the network, including detect the ip addr,netmask, and send the arp request to find out locale's ip-mac turtple, is there any way to succeed this exlude 'subprocess call'? Try scapy: http://

Re: Changing tab behavior in Python Interactive mode

2010-01-29 Thread Steve Holden
Andrej Mitrovic wrote: > On Jan 29, 6:47 pm, Steve Holden wrote: >> Andrej Mitrovic wrote: >>> I've noticed that when running Python in interactive mode (via cmd on >>> windows), the first time I hit tab it will move 4 spaces to the right, >>> however each new tab will move 8 spaces instead of 4.

Re: Killing a Thread

2010-01-29 Thread Gabriel Genellina
En Thu, 28 Jan 2010 10:25:30 -0300, Richard Lamboj escribió: which Method is better to kill a Thread? Using Thread Events, or a raising a Exception? Maybe someone has a small example for me? The best way is simply NOT to do that. You don't kill a thread, you ask it to commit suicide. T

Re: Some C-API functions clear the error indicator?

2010-01-29 Thread Austin Bingham
Maybe I'm not following what you're saying. In my case, I already know that an exception has been thrown. In the course of processing that exception, I call another function which, for whatever reason and even when it succeeds, clears the exception indicators. How can I address this issue by checki

Thread safe locale techniques?

2010-01-29 Thread python
We're currently writing a web application based on a threaded python web server framework (cherrypy) and would like to simultaneously support users from multiple locales. The locale module doesn't appear to be thread safe. Are there 3rd party libraries or modules that provide locale parsing and fo

Re: Keyboard input

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 13:53:43 -0300, Mr.SpOOn escribió: I need to get keyboard input in a python program. I need it to let the user choose some options, for example: 1) option 1 2) option 2 3) option 3 and then to input some data to the program. I'm using the raw_input method and it works f

Re: Changing tab behavior in Python Interactive mode

2010-01-29 Thread Andrej Mitrovic
On Jan 29, 10:07 pm, Steve Holden wrote: > Andrej Mitrovic wrote: > > On Jan 29, 6:47 pm, Steve Holden wrote: > >> Andrej Mitrovic wrote: > >>> I've noticed that when running Python in interactive mode (via cmd on > >>> windows), the first time I hit tab it will move 4 spaces to the right, > >>>

Re: Data exchange between Delphi and Python (Win)

2010-01-29 Thread Gabriel Genellina
En Thu, 28 Jan 2010 05:07:00 -0300, Durumdara escribió: I have an exotic db, with exotic drivers, and it have buggy ODBC driver. But I have native driver - under Delphi. I need to access this DB under Pylons (or mod_python). [...] I think to COM/OLE, because it is accessable from all progr

Re: Keyboard input

2010-01-29 Thread rantingrick
On Jan 29, 3:38 pm, "Gabriel Genellina" wrote: > but it's a big   > move. wxPython would let you write a graphical interface (and it's a   > bigger move!) > > -- > Gabriel Genellina *ahem*!, tkinter is just a slightly medium move, and my god it's in the stdlib for crying out loud!! -- http://

Re: Keyboard input

2010-01-29 Thread Jonathan Gardner
On Jan 29, 8:53 am, "Mr.SpOOn" wrote: > Hi, > I need to get keyboard input in a python program. I need it to let the > user choose some options, for example: > > 1) option 1 > 2) option 2 > 3) option 3 > > and then to input some data to the program. > > I'm using the raw_input method and it works

Re: Threading issue with SQLite

2010-01-29 Thread Jonathan Gardner
On Jan 29, 8:37 am, Alan Harris-Reid wrote: > > Questions... > 1.  Is there a large overhead in opening a new SQLite connection for > each thread (ie. within each method)? Yes, but not as bad as some other DBs. > 2.  Is there any way to use the same connection for the whole class (or > should I

Re: myths about python 3

2010-01-29 Thread Carl Banks
On Jan 29, 12:25 am, "Martin v. Loewis" wrote: > > Well, I'd consider that an official release.  Note that I didn't claim > > there was no hope PSF wouldn't change it's mind on 2.8. > > I'd like to point out that the PSF formally doesn't have any say in > this. Doesn't PSF own the Python trademar

Re: which one is faster?

2010-01-29 Thread Jonathan Gardner
On Jan 28, 10:29 pm, "Stephen.Wu" <54wut...@gmail.com> wrote: > str.find(targetStr) > str.index(targetStr) with exception > str.count(targetStr) > targetStr in str > > which is the fastest way to check whether targetStr is in str? > The fastest way of all is to forget about this and finish the res

Re: myths about python 3

2010-01-29 Thread Ben Finney
Duncan Booth writes: > Here's what I see in the Ubuntu packages. Python 3 seems only to be in the > universe repositories so far. > > Dapper: Python 2.4.2 > Hardy: Python 2.5.2 > Intrepid: Python 2.5.2, 3.0~b3 (universe) > Jaunty: Python 2.6.2, 3.0.1 (universe) > Karmic: Python 2.6.4rc1, 3.1 (un

Re: For loop searching takes too long!

2010-01-29 Thread Jonathan Gardner
On Jan 28, 3:52 pm, elsa wrote: > > I've got a problem with my program, in that the code just takes too > long to run. Here's what I'm doing. If anyone has any tips, they'd be > much appreciated! > First of all, don't play with large lists. Large lists have a tendency to grow larger over time, un

C API: module cleanup function

2010-01-29 Thread Mr.M
Hi, I can't figure out if there is a way to run a specialized cleanup function when a module needs to be "unloaded" (i.e. just before a reload() or when i quit the interpreter). I'm thinking of something like tp_dealloc. If I call Py_InitModule3 and look at module->ob_type->tp_dealloc, I fin

Re: C API: module cleanup function

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 19:50:52 -0300, Mr.M escribió: I can't figure out if there is a way to run a specialized cleanup function when a module needs to be "unloaded" (i.e. just before a reload() or when i quit the interpreter). I think what you want to do isn't possible with Python 2, and it'

Re: C API: module cleanup function

2010-01-29 Thread Mr.M
Gabriel Genellina ha scritto: I think what you want to do isn't possible with Python 2, and it's one of the reasons the module handling was redesigned in Python 3.x; see PEP 3121. Thank you Gabriel for your help. Unlucky I can't use Python 3.x in my project, sob! Luca. -- http://mail.python

Re: Python-list Digest, Vol 76, Issue 303

2010-01-29 Thread Gabriel Genellina
[top posting corrected] From: Steve Holden Date: Tue, 26 Jan 2010 11:54:23 -0500 Anyway, I suspect your error might go away if you turned the first argument of hte log.info() call into a format string such as log.info("refer: %s", ret) try: log.info("start") log.info("refer",ret)

Re: Some C-API functions clear the error indicator?

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 18:25:14 -0300, Austin Bingham escribió: Maybe I'm not following what you're saying. In my case, I already know that an exception has been thrown. In the course of processing that exception, I call another function which, for whatever reason and even when it succeeds, clea

Re: Changing tab behavior in Python Interactive mode

2010-01-29 Thread Terry Reedy
On 1/29/2010 4:43 PM, Andrej Mitrovic wrote: On Jan 29, 10:07 pm, Steve Holden wrote: Andrej Mitrovic wrote: On Jan 29, 6:47 pm, Steve Holden wrote: Andrej Mitrovic wrote: I've noticed that when running Python in interactive mode (via cmd on windows), the first time I hit tab it will move 4

Re: image processing - inverse filtering

2010-01-29 Thread Aahz
In article <5bfefbb6-89a8-49f6-9f02-7d36dfbc0...@c29g2000yqd.googlegroups.com>, suresh.amritapuri wrote: > >If I am using scipy.ndimage.gaussian_filter() for filtering an image, >how to do the inverse filtering? In general how to do this using >scipy.ndimage? http://projects.scipy.org/mailman/lis

  1   2   >