Re: how can I clear a dictionary in python

2007-04-10 Thread Antoon Pardon
On 2007-04-04, Aahz [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-03, Aahz [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Larry Bates [EMAIL PROTECTED] wrote: Aahz wrote: In article [EMAIL PROTECTED], Larry Bates [EMAIL

setup() and C extensions

2007-04-10 Thread 7stud
Hi, I can't find any documentation on the setup() function in the distutils.core module; specifically I want to know what the 'name' argument does. In some examples in the python docs, they use the name argument like this: from distutils.core import setup, Extension module1 =

Re: TASK KILL

2007-04-10 Thread Michel Claveau
Will TASKKILL kills a thread when thread id is given ?? Or does it kill only a process?? How to ensure that a thread is killed? Hi! Sorry, TASKKILL is only for process. For help on TASKKILL :TASKKILL /? Other infos with TASKLIST (TASKLIST /?) If the object who use process is a service

Re: setup() and C extensions

2007-04-10 Thread 7stud
Also: 1) When you create a C array to map python names to the C functions that you defined: static PyMethodDef MyFunctions[] = { {my_calc, (PyCFunction)my_func, METH_VARARGS, my very speedy c function}, {NULL, NULL, 0, NULL} }; Why do you need to cast my_func to PyCFunction? 2) When

Re: Queue get timeout parameter question

2007-04-10 Thread Godzilla
On Apr 10, 2:20 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: Godzilla [EMAIL PROTECTED] writes: After the time sync, say 15 seconds backward, the thread is sitting on that get() method for a total of 17 seconds. We can only sync the device once per day and the time can drift up to 15

how to get char ASCII value.

2007-04-10 Thread veblen . lee
for an example: 'a' value 0x61 '1' value 0x31. -- http://mail.python.org/mailman/listinfo/python-list

Re: Database in memory

2007-04-10 Thread Hendrik van Rooyen
Jeremy Sanders [EMAIL PROTECTED] wrote: Dictionaries are one of the most useful things in Python. Make sure you know how to take adavantage of them... +1 for QOTW - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: [offtopic?] problem with UDP broadcast on Windows XP

2007-04-10 Thread Hendrik van Rooyen
Irmen de Jong [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: Try running the service impersonating another user (not LOCAL_SERVICE, the default). You can change that from the service control panel. Alas, that didn't change anything. I made it run as a user account that has

Re: how to get char ASCII value.

2007-04-10 Thread 7stud
On Apr 10, 12:57 am, [EMAIL PROTECTED] wrote: for an example: 'a' value 0x61 '1' value 0x31. How about: import string for char in string.lowercase: print hex(ord(char) ) -- http://mail.python.org/mailman/listinfo/python-list

Re: Exec Statement Question

2007-04-10 Thread [EMAIL PROTECTED]
Thanks for the responses everyone. That does make sense to me now. -Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue get timeout parameter question

2007-04-10 Thread Thomas Krüger
Godzilla schrieb: I have been using the queue module for a multithreaded environment and things seem to work well... until we had a requirement for the application to be able to time sync to the server. With the time sync, it actually disorientated the timeout in the queue's get() method...

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-06, Carsten Haese [EMAIL PROTECTED] wrote: On Fri, 2007-04-06 at 11:33 -0700, 7stud wrote: On Apr 6, 7:56 am, Paul Boddie [EMAIL PROTECTED] wrote: The problem with 7stud's quote from GvR is that it's out of date: I would argue that it shows the very guy who invented the language

exec statement Syntax Error on string pulled from MySQL

2007-04-10 Thread [EMAIL PROTECTED]
It's the strangest thing, I'm pulling some text out of a MySQL table and trying to run exec on it, and it keeps giving me a syntax error, always at the end of the first line. Thanks in advance for any help. I'm really stuck on this one! -Greg I'm not sure what information would be most useful

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-08, Carsten Haese [EMAIL PROTECTED] wrote: On Sun, 2007-04-08 at 07:51 -0700, Paul Rubin wrote: Carsten Haese [EMAIL PROTECTED] writes: Maybe we can add such methods to the PyPy tuples for some time, to experimentally see if they make the language worse :-) Adding useless

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-09, Georg Brandl [EMAIL PROTECTED] wrote: Paul Rubin schrieb: Carsten Haese [EMAIL PROTECTED] writes: Will tuples also get a sort method? What about append and extend? pop? __iadd__? __delslice__? They are immutable so they won't get .sort() etc. sorted(...) already works on

Re: exec statement Syntax Error on string pulled from MySQL

2007-04-10 Thread Duncan Booth
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: To really get a picture of what is coming out of the DB I had the program print out everything about this string using this code: print code print repr(code) print type(code) for char in code: print ord(char),char To

Re: Queue get timeout parameter question

2007-04-10 Thread Godzilla
On Apr 10, 5:38 pm, Thomas Krüger [EMAIL PROTECTED] wrote: Godzilla schrieb: I have been using the queue module for a multithreaded environment and things seem to work well... until we had a requirement for the application to be able to time sync to the server. With the time sync, it

Re: pluie documentation in english

2007-04-10 Thread M�ta-MCI
Bonjour ! Avec Internet-Explorer 6 : Dans Internet-explorer, par le menu, faire : Outils + Options_internet Aller sur le dernier onglet (Avancé), et cocher : autoriser le contenu actif (désolé pour le français, mais mon anglais est vraiment trop mauvais). Et, merci pour l'info, ça m'a

Re: RFC: Assignment as expression (pre-PEP)

2007-04-10 Thread Georg Brandl
Alex Martelli schrieb: Adam Atlas [EMAIL PROTECTED] wrote: Hasn't this been discussed many many times before? I think Guido has been favourable to the idea of allowing :=, but that was a long time ago, and I don't think anything ever came of it. Personally, if anything, I'd like to see

NLTK, Random Sentence Generators?

2007-04-10 Thread Passer By
Has any created or not of examples of random sentence generators using n-gram models (or other models might be interesting). I know of one example from a course at MIT, but besides that nothing. Any help would be great. -- http://mail.python.org/mailman/listinfo/python-list

Re: exec statement Syntax Error on string pulled from MySQL

2007-04-10 Thread Georg Brandl
[EMAIL PROTECTED] schrieb: It's the strangest thing, I'm pulling some text out of a MySQL table and trying to run exec on it, and it keeps giving me a syntax error, always at the end of the first line. Thanks in advance for any help. I'm really stuck on this one! -Greg I'm not sure

Re: tuples, index method, Python's design

2007-04-10 Thread Duncan Booth
Antoon Pardon [EMAIL PROTECTED] wrote: When a new feature is requested, the burden of proof is on the requester to show that it has uses. I don't agree. Good or bad design is not dependant on what is implemented and what is not. There is a cost to every new language feature: it has to be

Why is __getslice__ still implemented?

2007-04-10 Thread Torsten Bronger
Hallöchen! According to http://docs.python.org/ref/sequence-methods.html, __getslice__ is deprecated. At the moment, I derive an own class from unicode and want to implement my own slicing. I found that I have to override __getslice__ since __getitem__ isn't called when I have something like

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: Antoon Pardon [EMAIL PROTECTED] wrote: When a new feature is requested, the burden of proof is on the requester to show that it has uses. I don't agree. Good or bad design is not dependant on what is implemented and what is not. There

Re: confirm password for logged in user

2007-04-10 Thread René Fleschenberg
André Wyrwa schrieb: I'm wondering, though, if there isn't ANY way to have the password confirmed for the user that is already logged in. Please note the difference, i don't want to write some kind of login functionality. The user is already authenticated, i just want to have a typed in

Re: tuples, index method, Python's design

2007-04-10 Thread Paul Boddie
On 10 Apr, 11:48, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: There is a cost to every new language feature: it has to be implemented, documented, maintained, and above all learned by the users. Good design involves, in part, not adding to

Re: Why is __getslice__ still implemented?

2007-04-10 Thread James Stroud
Torsten Bronger wrote: Hallöchen! According to http://docs.python.org/ref/sequence-methods.html, __getslice__ is deprecated. At the moment, I derive an own class from unicode and want to implement my own slicing. I found that I have to override __getslice__ since __getitem__ isn't called

Re: NLTK, Random Sentence Generators?

2007-04-10 Thread James Stroud
Passer By wrote: Has any created or not of examples of random sentence generators using n-gram models (or other models might be interesting). I know of one example from a course at MIT, but besides that nothing. Any help would be great. Best is to just cull text from your spam folder

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Paul Boddie [EMAIL PROTECTED] wrote: Now with implementation and maintaining. If you would start with a class of sequence which classes like tuple and list would inherit from, then there also would be a single function to be implemented and maintained. It would just be usable

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Torsten Bronger
Hallöchen! James Stroud writes: [...] Which version of python are you using? 2.4 chernev 20% /sw/bin/python Python 2.5 (r25:51908, Oct 10 2006, 03:45:47) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type help, copyright, credits or license for more information. py class

RE: Breaking up Strings correctly:

2007-04-10 Thread Michael Yanowitz
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Adam Atlas Sent: Monday, April 09, 2007 11:28 PM To: python-list@python.org Subject: Re: Breaking up Strings correctly: On Apr 9, 8:19 am, Michael Yanowitz [EMAIL PROTECTED] wrote: Hello: I have been

Re: Custom Python Runtime

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 00:17:33 -0300, Jack [EMAIL PROTECTED] escribió: 1. One Windows, it's possible to zip all files in a Python24.zip. I'm not very clear if it's used in the stardard distribution. What can, and what can not be put into this file? I suppose zip file will help reduce the

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On 10 Apr 2007 07:31:13 GMT, Antoon Pardon wrote On 2007-04-06, Carsten Haese [EMAIL PROTECTED] wrote: If you have a use case for tuple.index, please show it to me, and I'll show you what you should be using instead of a tuple. No wonder no convincing use cases for tuples have shown up.

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On 10 Apr 2007 09:48:41 GMT, Antoon Pardon wrote If someone states: Show me your use case for using tuple.index and I will show you how to avoid it. or words to that effect I think there is little use trying. Or maybe you just can't think of any good use cases, and that's annoying you because

Re: setup() and C extensions

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 03:02:22 -0300, 7stud [EMAIL PROTECTED] escribió: I can't find any documentation on the setup() function in the distutils.core module; specifically I want to know what the 'name' argument does. In some examples in the python docs, they use the name argument like this:

Re: NLTK, Random Sentence Generators?

2007-04-10 Thread Passer By
James Stroud [EMAIL PROTECTED] writes: Passer By wrote: Has any created or not of examples of random sentence generators using n-gram models (or other models might be interesting). I know of one example from a course at MIT, but besides that nothing. Any help would be great. Best

Re: setup() and C extensions

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 03:35:35 -0300, 7stud [EMAIL PROTECTED] escribió: 1) When you create a C array to map python names to the C functions that you defined: static PyMethodDef MyFunctions[] = { {my_calc, (PyCFunction)my_func, METH_VARARGS, my very speedy c function}, {NULL, NULL,

Re: Database in memory

2007-04-10 Thread Nicko
Jim wrote: I have an application that will maintain an in-memory database in the form of a list of lists. Does anyone know of a way to search for and retreive records from such a structure? The answer very much depends on the manner in which you want to do the look-up. If you only need to do

Re: Plugin architecture - how to do?

2007-04-10 Thread c james
Take a look at Trac. This might give you some ideas. http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Carsten Haese [EMAIL PROTECTED] wrote: On 10 Apr 2007 07:31:13 GMT, Antoon Pardon wrote On 2007-04-06, Carsten Haese [EMAIL PROTECTED] wrote: If you have a use case for tuple.index, please show it to me, and I'll show you what you should be using instead of a tuple. No

Re: pluie documentation in english

2007-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 3:14 am, Méta-MCI [EMAIL PROTECTED] wrote: Bonjour ! Avec Internet-Explorer 6 : Dans Internet-explorer, par le menu, faire : Outils + Options_internet Aller sur le dernier onglet (Avancé), et cocher : autoriser le contenu actif (désolé pour le français, mais mon anglais est

Re: pluie documentation in english

2007-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 3:14 am, Méta-MCI [EMAIL PROTECTED] wrote: Bonjour ! Avec Internet-Explorer 6 : Dans Internet-explorer, par le menu, faire : Outils + Options_internet Aller sur le dernier onglet (Avancé), et cocher : autoriser le contenu actif (désolé pour le français, mais mon anglais est

Re: tuples, index method, Python's design

2007-04-10 Thread Duncan Booth
Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: There is a cost to every new language feature: it has to be implemented, documented, maintained, and above all learned by the users. Good design involves, in part, not adding to these burdens except

Re: Hosting Companies: Help for Python Users?

2007-04-10 Thread Steve Holden
Neil Hodgson wrote: Steve Holden: Dennis Lee Beiber: Too many 3rd-party modules still aren't available in 2.5 versions for my tastes... This applies particularly (though not exclusively) to the Windows platform, for various reasons -- the most common one is that Linux developers

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 12:29 +, Antoon Pardon wrote: On 2007-04-10, Carsten Haese [EMAIL PROTECTED] wrote: On 10 Apr 2007 07:31:13 GMT, Antoon Pardon wrote On 2007-04-06, Carsten Haese [EMAIL PROTECTED] wrote: If you have a use case for tuple.index, please show it to me, and I'll

Re: [offtopic?] problem with UDP broadcast on Windows XP

2007-04-10 Thread Steve Holden
Hendrik van Rooyen wrote: Irmen de Jong [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: Try running the service impersonating another user (not LOCAL_SERVICE, the default). You can change that from the service control panel. Alas, that didn't change anything. I made it run as a

Re: setup() and C extensions

2007-04-10 Thread Carsten Haese
On Mon, 2007-04-09 at 23:35 -0700, 7stud wrote: 2) When returning None, why use the idiom: Py_INCREF(Py_None); return Py_None; instead of: return Py_BuildValue(); As Gabriel said, the preferred idiom is faster and clearer. Sufficiently recent Pythons define the macro Py_RETURN_NONE

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: There is a cost to every new language feature: it has to be implemented, documented, maintained, and above all learned by the users. Good design

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Carsten Haese [EMAIL PROTECTED] wrote: Adding the index method to tuples is not adding a feature. It is removing a limitation. The non-existence of tuple.index is only a limitation if there is a need for the method to exist. Please prove that this need exists. It doesn't

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Carsten Haese [EMAIL PROTECTED] wrote: On 10 Apr 2007 09:48:41 GMT, Antoon Pardon wrote If someone states: Show me your use case for using tuple.index and I will show you how to avoid it. or words to that effect I think there is little use trying. Or maybe you just can't think

Broken pipe with os.popen3()

2007-04-10 Thread Christoph Krammer
Hello everybody, I try to use an external OCR tool to convert some binary image data to text. The image is in one variable, the text should be converted to another. I use the following code: (si, so, se) = os.popen3('ocrad') si.write(frame) si.close() messagetext += so.read() This code

Python Speech tools

2007-04-10 Thread Amit K Saha
Hi list I intend to design a Speech Recognition system.Can I have some pointers to the available Python speech tools? Till date I am aware of only Python bindings for a speech tool called Snack (http://www.speech.kth.se/snack/) Any help will be appreciated. -- Amit K Saha [EMAIL PROTECTED]

Re: tuples, index method, Python's design

2007-04-10 Thread Steve Holden
Paul Boddie wrote: On 10 Apr, 11:48, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: There is a cost to every new language feature: it has to be implemented, documented, maintained, and above all learned by the users. Good design involves, in part,

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 13:21 +, Antoon Pardon wrote: But if you are so eager to rewrite, how about the following: I am using the struct module to get binary data from a file. Sometimes I want to skip until I find a particular binary number. Somewhat simplified it looks like this:

Re: Python Speech tools

2007-04-10 Thread kyosohma
On Apr 10, 2:15 pm, Amit K Saha [EMAIL PROTECTED] wrote: Hi list I intend to design a Speech Recognition system.Can I have some pointers to the available Python speech tools? Till date I am aware of only Python bindings for a speech tool called Snack (http://www.speech.kth.se/snack/) Any

Re: Broken pipe with os.popen3()

2007-04-10 Thread Thomas Guettler
Christoph Krammer wrote: Hello everybody, I try to use an external OCR tool to convert some binary image data to text. The image is in one variable, the text should be converted to another. I use the following code: (si, so, se) = os.popen3('ocrad') si.write(frame) si.close()

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 09:57 -0400, Steve Holden wrote: I hear the screams of just add the index() method to tuples and have done with it and, to an extent, can sympathize with them. But that way lies creeping featurism and the next thing you know we'll have a ternary operator in the

Re: Problem with getting an option value

2007-04-10 Thread Lucas Malor
Peter Otten wrote: Lucas Malor wrote: The problem is options is an instance, so options.delete, for example, is wrong; I should pass options.delete . How can I do? Use getattr(): Thank you. Do you know also if I can do a similar operation with functions? I want to select with a string a

Re: tuples, index method, Python's design

2007-04-10 Thread Paul Boddie
On 10 Apr, 15:57, Steve Holden [EMAIL PROTECTED] wrote: The point I am trying to make is that circumstances alter cases, and that we can't always rely on our intuition to determine how specific methods work, let alone whether they are available. But it's telling that by adopting precisely the

Re: Breaking up Strings correctly:

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 08:12:53 -0300, Michael Yanowitz [EMAIL PROTECTED] escribió: I guess what I was looking for was something simpler than parsing. I may actually use some of what you posted. But I am hoping that if given a string such as: '((($IP = 127.1.2.3) AND ($AX 15)) OR (($IP =

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Steven Bethard
Torsten Bronger wrote: Hallöchen! According to http://docs.python.org/ref/sequence-methods.html, __getslice__ is deprecated. At the moment, I derive an own class from unicode and want to implement my own slicing. I found that I have to override __getslice__ since __getitem__ isn't called

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Torsten Bronger wrote: Hallöchen! According to http://docs.python.org/ref/sequence-methods.html, __getslice__ is deprecated. At the moment, I derive an own class from unicode and want to implement my own slicing. I

Re: tuples, index method, Python's design

2007-04-10 Thread Steve Holden
Carsten Haese wrote: On Tue, 2007-04-10 at 09:57 -0400, Steve Holden wrote: I hear the screams of just add the index() method to tuples and have done with it and, to an extent, can sympathize with them. But that way lies creeping featurism and the next thing you know we'll have a ternary

convert html entities into real chars

2007-04-10 Thread Laszlo Nagy
Hi, I would like to have a function that can convert 'gt;' into '', 'amp;' into '' etc. I could not find how to do it easily (I have a code snippet for the opposite). Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: Check for keypress on Linux xterm ?

2007-04-10 Thread hlubenow
Grant Edwards wrote: On 2007-04-09, hlubenow [EMAIL PROTECTED] wrote: My problem is, I don't want my program to wait for the keypress. I just want to check, if a key is currently pressed and if not, I'd like to continue with my program (like INKEY$ in some BASIC-dialects). The answer to

Re: tuples, index method, Python's design

2007-04-10 Thread BJörn Lindqvist
On 4/10/07, Carsten Haese [EMAIL PROTECTED] wrote: i = p.index(current_player) opponents = p[:i-1] + p[i+1:] An alternative is this: opponents = tuple(x for x in p if x is not current_player) You may disagree, but in my opinion, the alternative is better because it is a more natural

Re: convert html entities into real chars

2007-04-10 Thread Laszlo Nagy
I would like to have a function that can convert 'gt;' into '', 'amp;' into '' etc. I could not find how to do it easily (I have a code snippet for the opposite). Found it, sorry def convertentity(m): Convert a HTML entity into normal string (ISO-8859-1) if m.group(1)=='#':

Re: tuples, index method, Python's design

2007-04-10 Thread BJörn Lindqvist
On 4/10/07, Steve Holden [EMAIL PROTECTED] wrote: Paul Boddie wrote: On 10 Apr, 11:48, Antoon Pardon [EMAIL PROTECTED] wrote: On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote: There is a cost to every new language feature: it has to be implemented, documented, maintained, and above

Re: Problem with getting an option value

2007-04-10 Thread Bruno Desthuilliers
Lucas Malor a écrit : Peter Otten wrote: Lucas Malor wrote: The problem is options is an instance, so options.delete, for example, is wrong; I should pass options.delete . How can I do? Use getattr(): Thank you. Do you know also if I can do a similar operation with functions? I want to

Re: Problem with getting an option value

2007-04-10 Thread Larry Bates
Lucas Malor wrote: Peter Otten wrote: Lucas Malor wrote: The problem is options is an instance, so options.delete, for example, is wrong; I should pass options.delete . How can I do? Use getattr(): Thank you. Do you know also if I can do a similar operation with functions? I want to

Re: tuples, index method, Python's design

2007-04-10 Thread Steve Holden
Paul Boddie wrote: On 10 Apr, 15:57, Steve Holden [EMAIL PROTECTED] wrote: The point I am trying to make is that circumstances alter cases, and that we can't always rely on our intuition to determine how specific methods work, let alone whether they are available. But it's telling that by

Re: convert html entities into real chars

2007-04-10 Thread Larry Bates
Laszlo Nagy wrote: Hi, I would like to have a function that can convert 'gt;' into '', 'amp;' into '' etc. I could not find how to do it easily (I have a code snippet for the opposite). Thanks, Laszlo You can use htmlentitydefs module to help with this. import htmlentitydefs

installing pyqt4 on ubuntu 6.06

2007-04-10 Thread Pradnyesh Sawant
Hello, I have a newly installed ubuntu 6.06 system. I am trying to install pyqt4 on it, but without success. The contents of the /etc/apt/sources.list file are: deb http://in.archive.ubuntu.com/ubuntu/ dapper main

Parsing log in SQL DB to change IPs to hostnames

2007-04-10 Thread KDawg44
Hi, I am brand new to Python. In learning anything, I find it useful to actually try to write a useful program to try to tackle an actual problem. I have a syslog server and I would like to parse the syslog messages and try to change any ips to resolved hostnames. Unfortunately, I am not

Re: installing pyqt4 on ubuntu 6.06

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 21:05:37 +0530, Pradnyesh Sawant [EMAIL PROTECTED] wrote: Hello, I have a newly installed ubuntu 6.06 system. I am trying to install pyqt4 on it, but without success. The contents of the /etc/apt/sources.list file are:

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 17:10 +0200, BJörn Lindqvist wrote: On 4/10/07, Carsten Haese [EMAIL PROTECTED] wrote: i = p.index(current_player) opponents = p[:i-1] + p[i+1:] An alternative is this: opponents = tuple(x for x in p if x is not current_player) You may disagree, but in my

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 11:44 -0400, Carsten Haese wrote: On Tue, 2007-04-10 at 17:10 +0200, BJörn Lindqvist wrote: On 4/10/07, Carsten Haese [EMAIL PROTECTED] wrote: i = p.index(current_player) opponents = p[:i-1] + p[i+1:] An alternative is this: opponents = tuple(x for x in p

Re: Check for keypress on Linux xterm ?

2007-04-10 Thread hlubenow
Grant Edwards wrote: On 2007-04-09, hlubenow [EMAIL PROTECTED] wrote: My problem is, I don't want my program to wait for the keypress. I just want to check, if a key is currently pressed and if not, I'd like to continue with my program (like INKEY$ in some BASIC-dialects). The answer to

Re: install wxPython

2007-04-10 Thread kyosohma
On Apr 9, 3:20 pm, Marco [EMAIL PROTECTED] wrote: Hi, I have a problem to install wxPython on my MacBook (Pythonversion 2.5). If would install the wxPython (python setup.py install), then I got this error: Traceback (most recent call last): File

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Steven Bethard
Jean-Paul Calderone wrote: On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Yes, you do still need to implement __getslice__ if you're subclassing a class (like unicode or list) which provides it. The __getslice__ method can't be removed entirely for backwards

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 09:51:45 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Jean-Paul Calderone wrote: On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Yes, you do still need to implement __getslice__ if you're subclassing a class (like unicode or list) which

Re: tuples, index method, Python's design

2007-04-10 Thread Paul Boddie
On 10 Apr, 17:29, Steve Holden [EMAIL PROTECTED] wrote: You can call something non-controversial when it generates a thread like this? :-) It's really a storm in a teacup. The acid test would be to generate a patch that added the method and then see if you could get a committer to commit it.

Re: Parsing log in SQL DB to change IPs to hostnames

2007-04-10 Thread Kushal Kumaran
On Apr 10, 8:37 pm, KDawg44 [EMAIL PROTECTED] wrote: Hi, I am brand new to Python. In learning anything, I find it useful to actually try to write a useful program to try to tackle an actual problem. I have a syslog server and I would like to parse the syslog messages and try to change

Re: tuples, index method, Python's design

2007-04-10 Thread Paul Boddie
On 10 Apr, 17:44, Carsten Haese [EMAIL PROTECTED] wrote: You have a point. Here is my revised solution: assert current_player in p opponents = tuple(x for x in p if x is not current_player) The added advantage is that AssertionError is better than IndexError for conveying that a severe

Re: Queue get timeout parameter question

2007-04-10 Thread skip
Godzilla Ok... But I'm afraid no syncing is not an option for the Godzilla device... Then you'll either need to use something like ntp or sync much more frequently so you don't yank the time by so much. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Check for keypress on Linux xterm ?

2007-04-10 Thread Grant Edwards
On 2007-04-10, hlubenow [EMAIL PROTECTED] wrote: My problem is, I don't want my program to wait for the keypress. I just want to check, if a key is currently pressed and if not, I'd like to continue with my program (like INKEY$ in some BASIC-dialects). The answer to this frequently asked

Re: tuples, index method, Python's design

2007-04-10 Thread Antoon Pardon
On 2007-04-10, Carsten Haese [EMAIL PROTECTED] wrote: On Tue, 2007-04-10 at 13:21 +, Antoon Pardon wrote: But if you are so eager to rewrite, how about the following: I am using the struct module to get binary data from a file. Sometimes I want to skip until I find a particular

Re: Check for keypress on Linux xterm ?

2007-04-10 Thread hlubenow
Grant Edwards wrote: I do make mistakes, but before telling somebody he's wrong, it might be a good idea to actually try what he's suggested. ;) I completely agree. The script waited at first for key-input, so I thought, I was right. But I was not. I apologize ! H. --

Re: NLTK, Random Sentence Generators?

2007-04-10 Thread gene tani
On Apr 10, 1:36 am, Passer By [EMAIL PROTECTED] wrote: Has any created or not of examples of random sentence generators using n-gram models (or other models might be interesting). I know of one example from a course at MIT, but besides that nothing. Any help would be great. Markov chains

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Torsten Bronger
Hallöchen! Steven Bethard writes: Torsten Bronger wrote: [...] [...] It forces people to implement a deprecated function after all. I think the docs should say that you still have to override __getslice__ when subclassing from a built-in type, unless I really don't understand the issue

grabbing Pictures from the web

2007-04-10 Thread Juan Vazquez
I am new to python (2 weeks old) and I would like to write a script that grabs pictures from the web (specifically flickr) and put them on a Tk Canvas for a slide show/editing program. my 2 questions are 1) How do I grab a picture from the web 2) is the use of the Tk canvas for working with the

Re: tuples, index method, Python's design

2007-04-10 Thread bearophileHUGS
BJörn Lindqvist: One might perversely allow extension to lists and tuples to allow [3, 4] in [1, 2, 3, 4, 5, 6] to succeed, but that's forcing the use case beyond normal limits. The point I am trying to make is that circumstances alter cases, and that we can't always rely on our

Re: tuples, index method, Python's design

2007-04-10 Thread BJörn Lindqvist
On 4/10/07, Carsten Haese [EMAIL PROTECTED] wrote: opponents = tuple(x for x in p if x is not current_player) Your alternative is wrong because it wont raise ValueError if current_player is not present in the tuple. Please revise your solution. You have a point. Here is my revised

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Steven Bethard
Torsten Bronger wrote: Hallöchen! Steven Bethard writes: Torsten Bronger wrote: [...] [...] It forces people to implement a deprecated function after all. I think the docs should say that you still have to override __getslice__ when subclassing from a built-in type, unless I really

Re: Database in memory

2007-04-10 Thread Nicko
On Apr 10, 1:10 pm, Nicko [EMAIL PROTECTED] wrote: If you expect to do exact-match look-up where the keys are not unique then build a dictionary containing 'set' objects which are the sets of records which have the given key. This lets you neatly find the intersection of selections on multiple

Re: tuples, index method, Python's design

2007-04-10 Thread Carsten Haese
On Tue, 2007-04-10 at 19:21 +0200, BJörn Lindqvist wrote: On 4/10/07, Carsten Haese [EMAIL PROTECTED] wrote: opponents = tuple(x for x in p if x is not current_player) Your alternative is wrong because it wont raise ValueError if current_player is not present in the tuple. Please

ANN: pywinauto 0.3.7 now released

2007-04-10 Thread Mark Mc Mahon
Hi, 0.3.7 release of pywinauto is now available. pywinauto is an open-source (LGPL) package for using Python as a GUI automation 'driver' for Windows NT based Operating Systems (NT/W2K/XP/Vista?). SourceForge project page: http://sourceforge.net/projects/pywinauto Download from SourceForge

Re: Having trouble with relative imports

2007-04-10 Thread Echo
On 4/9/07, Echo [EMAIL PROTECTED] wrote: Here is my setup: rpg -objects --__init__.py --gameobject.py --material.py -__init__.py -run_tests.py -stats.py the contents of run_test.py is: import objects as o the contents of objects/__init__.py is: from material import * in

writing my own extension

2007-04-10 Thread spohle
hi, i use a lot the enumerate in my scripts and got really interested in possibly writing my own enumerate as an extension, for which i would want to extend it to be able to pass a start and step attribute. can anyone point me on my way with good examples for that and how to write extensions ?

Universal Feed Parser issue

2007-04-10 Thread i3dmaster
I have a sample Atom feed like this: ?xml version='1.0' encoding='utf-8'? feed xmlns='http://www.w3.org/2005/Atom' xmlns:foo='http:// app.example.com/app/2007' idhttp://app.example.com/fjie4id939xdl3io23/id title type='text'foo/title author namebar/name email[EMAIL PROTECTED]/email

  1   2   >