Re: How to launch a function at regular time intervals ?

2009-08-14 Thread Frank Millman
On Aug 14, 12:52 am, David wrote: > > Yes, I guess it would be more simple. Here is really what I am trying > to do. I simplified the functions, but the purpose is to write some > text in a local file every x seconds (here, I'm just writing the > timestamp, i.e. a string representing the date & ti

Re: Nice copy in interactive terminal

2009-08-14 Thread casebash
I mainly develop on Linux these days, but if I ever end up doing anything on windows I'll make sure to look at that. On Aug 13, 6:56 pm, "Elias Fotinis \(eliasf\)" wrote: > "casebash" wrote: > > I've been wondering for a while if there exists an interactive > > terminal which has nice copy featur

socket.send : (11, 'Resource temporarily unavailable')

2009-08-14 Thread Gabriel Rossetti
Hello everyone, I get a (11, 'Resource temporarily unavailable') error when I try to send a file using a socket. Is there s size limit? I tried sending a smaller file and ii poses no problem. Am I doing something wrong? Here is the code: def sendMessage(host, port, msg): if isinstance(ms

Re: OptionParser How to: prog [options] [arguments]

2009-08-14 Thread Javier Collado
Hello, I think that this isn't possible with optparse library. However, it's possible with argparse (http://code.google.com/p/argparse/): http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#sub-commands It's not a standard library, but it's worth to take a look at it. Best regards,

Re: Plotting Quadratic Functions, pygame

2009-08-14 Thread Esmail
Hello Senad, You might find this style guide useful too in your toolbox of Python skills & tricks. http://www.python.org/dev/peps/pep-0008/ This is a great and helpful group of people here, we are lucky to have access to groups like this. Best, Esmail -- http://mail.python.org/mailman/list

Re: Plotting Quadratic Functions, pygame

2009-08-14 Thread Esmail
Hello Senad, You might find this style guide useful too in your toolbox of Python skills & tricks. http://www.python.org/dev/peps/pep-0008/ This is a great and helpful group of people here, we are lucky to have access to groups like this. Best, Esmail -- http://mail.python.org/mailman/list

Re: Format Code Repeat Counts?

2009-08-14 Thread jschwab
Thanks all! That was most helpful and informative. Best, Josiah -- http://mail.python.org/mailman/listinfo/python-list

Pygresql, and query meta informations

2009-08-14 Thread durumdara
Hi! Pygresql, DB-API. I search for a solution to get meta information about last query, because I must export these infos to Delphi. Delphi have TDataSet, and it have meta structure that must be defined before I create it. For char/varchar fields I must define their sizes! Pygresql is not retre

Re: socket.send : (11, 'Resource temporarily unavailable')

2009-08-14 Thread Gabriel Rossetti
Gabriel Rossetti wrote: Hello everyone, I get a (11, 'Resource temporarily unavailable') error when I try to send a file using a socket. Is there s size limit? I tried sending a smaller file and ii poses no problem. Am I doing something wrong? Here is the code: def sendMessage(host, port, m

Re: socket.send : (11, 'Resource temporarily unavailable')

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 09:15:34 Gabriel Rossetti wrote: > Hello everyone, > > I get a (11, 'Resource temporarily unavailable') error when I try to > send a file using a socket. Is there s size limit? I tried sending a > smaller file and ii poses no problem. Am I doing something wrong? Here > is t

Re: socket.send : (11, 'Resource temporarily unavailable')

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 09:47:50 Gabriel Rossetti wrote: > Gabriel Rossetti wrote: 8< -- > > Actually, the original code didn't have the sock.setblocking(0), the > problem I am trying to find is that the server does have > sock.setblocking(0) (I can't change

Re: Plotting Quadratic Functions, pygame

2009-08-14 Thread Bearophile
Senad Ibraimoski Of Belgrade: > Hello, I'm a new guy to this group, my professor recommend this group > to me, because I was boring him with questions.I'm new to python, and > I have problem plotting Quadratic Functions. Using module pygame. Python is a tool you use to learn something else, but to

Re: trouble with reload

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 13:49:19 +0900, Terry Reedy wrote: > Dr. Phillip M. Feldman wrote: >> According to the Python documentation, 'reload' reloads a previously >> imported module (so that changes made via an external editor will be >> effective). But, when I try to use this command, I get the follo

Re: Python "and" behavior

2009-08-14 Thread ryles
On Aug 13, 8:36 pm, goldtech wrote: > Could you explain or link me to an explanation of this? http://docs.python.org/tutorial/datastructures.html#more-on-conditions Give the whole tutorial a good read. -- http://mail.python.org/mailman/listinfo/python-list

Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me. I am running into the self same issue again. What I normally do is to open the port like this: p

Re: trouble with reload

2009-08-14 Thread Jean-Michel Pichavant
Dr. Phillip M. Feldman wrote: Actually, I've tried both of these, and I get (different) errors in both cases: In [1]: from mymath import * In [2]: reload(mymath) NameError: name 'mymath' is not defined In [3]: reload('mymath') TypeError: reload() argument must be module Please don't top p

Re: trouble with reload

2009-08-14 Thread Gabriel Genellina
En Fri, 14 Aug 2009 05:34:52 -0300, Steven D'Aprano escribió: On Fri, 14 Aug 2009 13:49:19 +0900, Terry Reedy wrote: Besides the other answers, do not use reload. It is removed in Py3 because it cannot be made to work as people reasonably expect. That's a damn shame, because it is very use

Re: OptionParser How to: prog [options] [arguments]

2009-08-14 Thread Carl Banks
On Aug 14, 12:18 am, Javier Collado wrote: > 2009/8/14 Steven Woody : > > > Hi, > > I am using OptionParser, but I've not managed figure out a way to support > > what I wanted command line format "prog [options] [arguments]". > > E.g., "svn ls -r123http://hello.world";. Can I do this using Opti

Re: OptionParser How to: prog [options] [arguments]

2009-08-14 Thread Gabriel Genellina
En Fri, 14 Aug 2009 03:22:49 -0300, Steven Woody escribió: I am using OptionParser, but I've not managed figure out a way to support what I wanted command line format "prog [options] [arguments]". E.g., "svn ls -r123 http://hello.world";. Can I do this using OptionParser? Extract the

Re: implementing descriptors

2009-08-14 Thread Jean-Michel Pichavant
Emile van Sebille wrote: On 8/13/2009 3:17 PM dippim said... I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in start is always before the one in end? class foo(object): def __i

Re: Python "and" behavior

2009-08-14 Thread Duncan Booth
MRAB wrote: > Operation Result >|x or y| x if x else y >|x and y| y if x else x >|not x| False if x else False > >:-) > That's not a terribly good definition for the 'not' operator. Try: |not x| False if x else True -- Duncan Booth http://kupuguy.blogspot.com -- htt

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me. I am running into the self same issue again. What I normally do is

Re: get the pause status from amarok 2.1

2009-08-14 Thread Diez B. Roggisch
Sleepy Cabbage schrieb: As the title says, I'm trying to find a way to get the pause status from amarok 2.1. I'm running kubuntu 9.04 with kde 4.2.2, python 2.6.2. Thanks in advance. Not at my linux-system right now, but dcop and the respective python-module should help. Diez -- http://ma

Re: need help calculating point between two coordinates.

2009-08-14 Thread Steven D'Aprano
On Thu, 13 Aug 2009 14:26:54 -0700, PeteDK wrote: > Hi there > > I'am working on a route comparison tool for carpools. > > The route comparison is based on 'steps' retrieved from google maps > GDirection. These steps vary in length and i use the coordinates at the > beginning of each "step". How

Re: Database query execution times in Python?

2009-08-14 Thread pwnedd
> Look up EXPLAIN Thanks for the suggestion. I don't see any option to have EXPLAIN display the query time though? -- View this message in context: http://www.nabble.com/Database-query-execution-times-in-Python--tp24870050p24969867.html Sent from the Python - python-list mailing list archive a

Re: How to reset document string

2009-08-14 Thread Anand K Rayudu
Dear Carl, Your ideas are extremely good, and I liked idea 2 especially, based on that I am considering following approach. Eg: let us say I have module named myModule and exposing myModule.myAPI So I will now rename myModule as _myModule and write a python layer with myModule So my python l

python-ldap and encodings

2009-08-14 Thread Matias
Hi! I'm using python-ldap to create some entries on my openldap server. The problem is that some of those entries have accented characters and unicode text in general. I'm wondering if there is any example or documentation on how to add or modify ldap objects whose values contains non-ascii c

Re: Format Code Repeat Counts?

2009-08-14 Thread MRAB
Scott David Daniels wrote: MRAB wrote: The shortest I can come up with is: "[" + "][".join(letters) + "]" Maybe a golf shot: "][".join(letters).join("[]") Even shorter: "["+"][".join(letters)+"]" :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: python-ldap and encodings

2009-08-14 Thread Matias
Matias wrote: Hi! I'm using python-ldap to create some entries on my openldap server. The problem is that some of those entries have accented characters and unicode text in general. I'm wondering if there is any example or documentation on how to add or modify ldap objects whose values conta

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread greg
Hendrik van Rooyen wrote: port = open("/dev/ttyS0","r+b",0) What I would really like is to have two threads - one that does blocking input waiting for a character, and one that examines an output queue and transmits the stuff it finds. You can't read and write with the same stdio file objec

anyone with genomewide microarray analysis experience ?

2009-08-14 Thread trias
Hi, I am trying to analyse some biological data from microarray experiments. Different experiments have been stored in a SQL database. One of the things I would like to do is to fetch all data from a certain distance from gene ATGs say 100+/- bp and calculate the bp average over all genes over

Re: anyone with genomewide microarray analysis experience ?

2009-08-14 Thread Jochen Schulz
trias: > > One of the things I would like to do is to fetch all data from a certain > distance from gene ATGs say 100+/- bp and calculate the bp average over all > genes over this region. I know absolutely nothing about your problem domain, but if your distance function is metric, you can use t

Re: trouble with reload

2009-08-14 Thread Colin J. Williams
Terry Reedy wrote: Dr. Phillip M. Feldman wrote: According to the Python documentation, 'reload' reloads a previously imported module (so that changes made via an external editor will be effective). But, when I try to use this command, I get the following error message: TypeError: reload() a

Re: csv.DictWriter.write_header()

2009-08-14 Thread Alan G Isaac
> On Aug 13, 1:15 pm, Alan G Isaac wrote: >> I do not understand the reason for your silly, sarcastic response. On 8/13/2009 7:58 AM John Machin apparently wrote: > Duck typing: ask a silly question, get a silly answer. Maybe if you learned to be a more generous reader, fewer questions would lo

Re: implementing descriptors

2009-08-14 Thread dippim
On Aug 14, 5:45 am, Jean-Michel Pichavant wrote: > Emile van Sebille wrote: > > On 8/13/2009 3:17 PM dippim said... > >> I am new to Python and I have a question about descriptors.  If I have > >> a class as written below, is there a way to use descriptors to be > >> certain that the datetime in s

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 12:54:32 Diez B. Roggisch wrote: > > How about using pyserial? With that, I never had any problems accessing > the the serial ports, and AFAIK no duplex-problems as well. And I > seriously doubt that these are a python-related problem - python only > has a very thin, direc

Re: implementing descriptors

2009-08-14 Thread Diez B. Roggisch
dippim schrieb: On Aug 14, 5:45 am, Jean-Michel Pichavant wrote: Emile van Sebille wrote: On 8/13/2009 3:17 PM dippim said... I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in s

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Hendrik van Rooyen
On Friday 14 August 2009 14:13:46 greg wrote: > You can't read and write with the same stdio file object > at the same time. Odd things tend to happen if you try. > > You need to open *two* file objects, one for reading > and one for writing: > >fr = open("/dev/ttyS0","rb",0) >fw = open("/

Re: implementing descriptors

2009-08-14 Thread dippim
On Aug 14, 2:34 am, Raymond Hettinger wrote: > [David] > > > > > I am new to Python and I have a question about descriptors.  If I have > > a class as written below, is there a way to use descriptors to be > > certain that the datetime in start is always before the one in end? > > > class foo(obje

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread exarkun
On 01:38 pm, hend...@microcorp.co.za wrote: On Friday 14 August 2009 12:54:32 Diez B. Roggisch wrote: How about using pyserial? With that, I never had any problems accessing the the serial ports, and AFAIK no duplex-problems as well. And I seriously doubt that these are a python-related probl

Re: Python "and" behavior

2009-08-14 Thread Ethan Furman
MRAB wrote: Gary Herron wrote: goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boole

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: On Friday 14 August 2009 14:13:46 greg wrote: You can't read and write with the same stdio file object at the same time. Odd things tend to happen if you try. You need to open *two* file objects, one for reading and one for writing: fr = open("/dev/ttyS0","rb",0

Re: Unrecognized escape sequences in string literals

2009-08-14 Thread Aahz
In article <6e13754c-1fa6-4d1b-8861-146bffec8...@h30g2000vbr.googlegroups.com>, Douglas Alan wrote: > >My friend begs to differ with the above. It would be much better for >debugging if Python generated a parsing error for unrecognized escape >sequences, rather than leaving them unchanged. g++ ou

Re: coding for multiple versions of python

2009-08-14 Thread Grant Edwards
On 2009-08-14, Martin v. L?wis wrote: >> I'm guessing I need to configure cvs to copy files to both >> locations whenever I commit. Does that sound right? Is there a >> better way I'm not thinking of? Just use one set of source files. > If the set of files doesn't change too often, you can use

Re: socket.send : (11, 'Resource temporarily unavailable')

2009-08-14 Thread Grant Edwards
On 2009-08-14, Gabriel Rossetti wrote: > I get a (11, 'Resource temporarily unavailable') error when I > try to send a file using a socket. Is there s size limit? No, there's no size limit. However, there is a bandwidth limit. You can't shove bytes into the pipe faster than they come out the o

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Hendrik van Rooyen wrote: > In the past, on this group, I have made statements that said > that on Linux, the serial port handling somehow does not allow > transmitting and receiving at the same time, That's not true. Linux/Unix does and always has supported full-duplex communica

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Hendrik van Rooyen wrote: > In the meantime I have had another idea which I have also not tried yet, > namely to do independent opens for reading and writing, to give me two file > instances instead of one, and to try with that. I have no idea if it would > make any difference,

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, exar...@twistedmatrix.com wrote: > One strategy you might employ to get rid of the busy looping > is to use Twisted and its serial port support. This also > addresses the full- duplex issue you've raised. There are no such full-dulex issues. -- Grant Edwards g

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread despen
"Martin P. Hellwig" writes: > Sounds like a bad case of STRIS > http://blog.dcuktec.com/2009/08/stris.html I believe the correct technical term for it is potty mouth. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Grant Edwards
On 2009-08-14, greg wrote: > Hendrik van Rooyen wrote: > >> port = open("/dev/ttyS0","r+b",0) >> >> What I would really like is to have two threads - one that >> does blocking input waiting for a character, and one that >> examines an output queue and transmits the stuff it finds. > > You can't r

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread exarkun
On 02:19 pm, inva...@invalid wrote: On 2009-08-14, exar...@twistedmatrix.com wrote: One strategy you might employ to get rid of the busy looping is to use Twisted and its serial port support. This also addresses the full- duplex issue you've raised. There are no such full-dulex issues. The

Re: implementing descriptors

2009-08-14 Thread Dave Angel
dippim wrote: On Aug 14, 2:34 am, Raymond Hettinger wrote: [David] I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in start is always before the one in end? clas

Re: coding for multiple versions of python

2009-08-14 Thread Dave Angel
Grant Edwards wrote: On 2009-08-14, Martin v. L?wis wrote: I'm guessing I need to configure cvs to copy files to both locations whenever I commit. Does that sound right? Is there a better way I'm not thinking of? Just use one set of source files. If the set of files doesn't ch

Re: Format Code Repeat Counts?

2009-08-14 Thread Scott David Daniels
MRAB wrote: Scott David Daniels wrote: MRAB wrote: The shortest I can come up with is: "[" + "][".join(letters) + "]" Maybe a golf shot: "][".join(letters).join("[]") Even shorter: "["+"][".join(letters)+"]" :-) I was going by PEP8 rules. ;-) --Scott David Daniels Scott Da

callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the instance calling the method has defined that method as well. Example: c

Re: trouble with reload

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote: > It's typically a user module that needs to be reloaded. What's a user module? > It seems that del sys.modules['moduleName'] has no effect. sys.modules is just a dictionary, I find it hard to believe that deleting from it has no e

Re: Programming by Contract

2009-08-14 Thread Charles Yeomans
On Aug 14, 2009, at 12:09 AM, Scott David Daniels wrote: Charles Yeomans wrote: On Aug 11, 2009, at 3:30 PM, Ethan Furman wrote: Ethan Furman wrote: Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very brief look at pycontract (http:

Re: implementing descriptors

2009-08-14 Thread dippim
On Aug 14, 10:48 am, Dave Angel wrote: > dippim wrote: > > On Aug 14, 2:34 am, Raymond Hettinger wrote: > > >> [David] > > >>> I am new to Python and I have a question about descriptors.  If I have > >>> a class as written below, is there a way to use descriptors to be > >>> certain that the date

Re: implementing descriptors

2009-08-14 Thread dippim
On Aug 14, 10:48 am, Dave Angel wrote: > dippim wrote: > > On Aug 14, 2:34 am, Raymond Hettinger wrote: > > >> [David] > > >>> I am new to Python and I have a question about descriptors.  If I have > >>> a class as written below, is there a way to use descriptors to be > >>> certain that the date

Re: callable virtual method

2009-08-14 Thread MRAB
Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the instance calling the method has defined that

Re: callable virtual method

2009-08-14 Thread Diez B. Roggisch
Jean-Michel Pichavant schrieb: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the instance calling the method has defined th

retrieve item from nested list given index tuple

2009-08-14 Thread Alan G Isaac
`lst` is a nested list `tpl` is the indexes for an item in the list What is the nice way to retrieve the item? (Speedy access is nice.) I don't want to use NumPy, but I'd like somehow to avoid an explicit loop. I did consider using eval. E.g., eval('lst' + '[%d]'*len(tpl)%tpl). It works but se

Re: callable virtual method

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 16:49:47 +0200, Jean-Michel Pichavant wrote: > Hi fellows, > > Does anyone know a way to write virtual methods (in one virtual class) > that will raise an exception only if called without being overridden ? > Currently in the virtual method I'm checking that the class of the >

Why does my ftp script quit after couple of hours?

2009-08-14 Thread kk
Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I have a client scr

OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > "I saw `cout' being shifted "Hello world" times to the left and stopped > right there." --Steve Gonedes Assuming that's something real, and not invented for humour, I presume that's describing something possible in C++. Am I correct? What the he

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Diez B. Roggisch
kk schrieb: Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I hav

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread kk
Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your assestment. I

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Grant Edwards
On 2009-08-14, Steven D'Aprano wrote: > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > >> "I saw `cout' being shifted "Hello world" times to the left and stopped >> right there." --Steve Gonedes > > Assuming that's something real, and not invented for humour, I presume > that's describing som

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Francesco Bochicchio
On 14 Ago, 18:03, kk wrote: > Hi > This way the first time I did something with ftp stuff. I think that > generally it works but it stops working(quits or disappears) after > couple of hours of running. > > This was a personal test-trial script for my own needs which was to > get my dynamic ip and

Natural Language Processing in Python

2009-08-14 Thread Prateek
Hi, Can somebody please provide me link to a good online resource or e- book for doing natural language processing programming in Python. Thanks, Prateek -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Diez B. Roggisch
kk schrieb: Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread MRAB
Grant Edwards wrote: On 2009-08-14, Steven D'Aprano wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: "I saw `cout' being shifted "Hello world" times to the left and stopped right there." --Steve Gonedes Assuming that's something real, and not invented for humour, I presume that's desc

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Douglas Alan
On Aug 14, 12:17 pm, Grant Edwards wrote: > On 2009-08-14, Steven D'Aprano wrote: > > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > >> "I saw `cout' being shifted "Hello world" times to the left and stopped > >> right there."  --Steve Gonedes > > > Assuming that's something real, and not i

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the instance calling the method ha

Re: Python Permutations Problem

2009-08-14 Thread MRAB
Asanka Wasala wrote: Hi I am developing a spell checker for my language, and I came across solving an interesing problem. It would be great if you can suggest me an optimized solution for the problem described below: I have certain group of letters like these: Group #1: c,r,b Group #2: a,z,k G

Re: callable virtual method

2009-08-14 Thread Diez B. Roggisch
Jean-Michel Pichavant schrieb: MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the

Python Permutations Problem

2009-08-14 Thread Asanka Wasala
Hi I am developing a spell checker for my language, and I came across solving an interesing problem. It would be great if you can suggest me an optimized solution for the problem described below: I have certain group of letters like these: Group #1: c,r,b Group #2: a,z,k Group #3: h,t . . Lette

Re: [Python-Dev] expy: an expressway to extend Python

2009-08-14 Thread Yingjie Lan
--- On Sat, 8/8/09, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: [Python-Dev] expy: an expressway to extend Python > To: python-...@python.org > Date: Saturday, August 8, 2009, 4:55 PM > > More details at http://expy.sourceforge.net/ > > I'm clearly biased, but my main concern here

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread vippstar
On Aug 14, 4:36 am, Xah Lee wrote: > • A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode >  http://xahlee.org/UnixResource_dir/writ/emacs_whitespace-mode_problem... Instead of writing a completely useless article you could had asked for help in an emacs newsgroup, or wait until som

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 15:54:54 +, Alan G Isaac wrote: > `lst` is a nested list > > `tpl` is the indexes for an item in the list > What is the nice way to retrieve the item? (Speedy access is nice.) Assuming you want to do this frequently, write a helper function, then use it: # Untested def

Re: csv.DictWriter.write_header()

2009-08-14 Thread Chris Withers
Alan G Isaac wrote: On 8/13/2009 7:58 AM John Machin apparently wrote: Duck typing: ask a silly question, get a silly answer. Maybe if you learned to be a more generous reader, fewer questions would look "silly" to you. If you take a look at the crap that John very patiently wades through on

Re: trouble with reload

2009-08-14 Thread Colin J. Williams
Steven D'Aprano wrote: On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote: It's typically a user module that needs to be reloaded. What's a user module? A module written by a user, as distinguished from a libary It seems that del sys.modules['moduleName'] has no effect. sys.m

Re: httplib incredibly slow :-(

2009-08-14 Thread Chris Withers
Aahz wrote: Sorry, I mostly have been working on our Mac port, so I'm not sure what's needed to make this work on Windows. Did you try downloading the PyCurl binary? Maybe it statically links libcurl on Windows. Shame it's not available as a bdist_egg, that's what I'm really after... What d

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread vippstar
On Aug 14, 8:25 pm, fortunatus wrote: > On Aug 14, 1:01 pm, vippstar wrote: > > > Why would you fill your website with junk? > > The OP made it clear: > > >Just wanted to express some frustration with whitespace-mode. You took my question out of context and answered it. I read the article, it's

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote: Jean-Michel Pichavant schrieb: MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm check

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread Jean-Michel Pichavant
vippstar wrote: On Aug 14, 8:25 pm, fortunatus wrote: On Aug 14, 1:01 pm, vippstar wrote: Why would you fill your website with junk? The OP made it clear: Just wanted to express some frustration with whitespace-mode. You took my question out of context and ans

Re: Unrecognized escape sequences in string literals

2009-08-14 Thread Steven D'Aprano
I think I've spent enough time on this discussion, so I won't be directly responding to any of your recent points -- it's clear that I'm not persuading you that there's any justification for any behaviour for escape sequences other than the way C++ deals with them. That's your prerogative, of c

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Colin J. Williams
Steven D'Aprano wrote: On Fri, 14 Aug 2009 15:54:54 +, Alan G Isaac wrote: `lst` is a nested list `tpl` is the indexes for an item in the list What is the nice way to retrieve the item? (Speedy access is nice.) Assuming you want to do this frequently, write a helper function, then us

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Alan G Isaac
On 8/14/2009 1:09 PM Steven D'Aprano apparently wrote: > Try this instead: > from operator import getitem reduce(getitem, (2, 1, 0), lst) > 'aaa' reduce(getitem, (2, 1, 0, 0), lst) > 'a' > > operator.getitem is less ugly too. Yes, that's better. Thanks, Alan -- http://mail.pytho

Re: trouble with reload

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 13:14:16 -0400, Colin J. Williams wrote: > Steven D'Aprano wrote: >> On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote: >> >>> It's typically a user module that needs to be reloaded. >> >> What's a user module? > A module written by a user, as distinguished from a l

Re: callable virtual method

2009-08-14 Thread Nigel Rantor
Jean-Michel Pichavant wrote: Your solution will work, for sure. The problem is that it will dumb down the Base class interface, multiplying the number of methods by 2. This would not be an issue in many cases, in mine there's already too much meaningful methods in my class for me to add artif

Komodo(!)

2009-08-14 Thread David C Ullrich
Probably this isn't news to anyone but me, but just in case: Last I heard Komodo was a very highly regarded IDE that unfortunately cost money. Yesterday I discovered that they now have an editor available for free. Doesn't contain all the features of the IDE, but just having glanced at it it seem

Re: callable virtual method

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 18:49:26 +0200, Jean-Michel Pichavant wrote: > Sorry guys (means guys *and* gals :op ), I realized I've not been able > to describe precisely what I want to do. I'd like the base class to be > virtual (aka abstract). However it may be abstract but it does not mean > it cannot d

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Nigel Rantor wrote: Jean-Michel Pichavant wrote: Your solution will work, for sure. The problem is that it will dumb down the Base class interface, multiplying the number of methods by 2. This would not be an issue in many cases, in mine there's already too much meaningful methods in my clas

Any way to adjust difflib algorithm?

2009-08-14 Thread Grant Edwards
I'm trying to use difflib to compare two files, and it's not producing very useful results. When comparing two lines where only a few characters have changed, it usually seems to decide that a line was deleted/inserted/replaced rather than changed. Here's how I'm using it: #!/usr/bin/python

Re: implementing descriptors

2009-08-14 Thread Dave Angel
dippim wrote: On Aug 14, 10:48 am, Dave Angel wrote: dippim wrote: On Aug 14, 2:34 am, Raymond Hettinger wrote: [David] I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain th

Re: callable virtual method

2009-08-14 Thread Nigel Rantor
Jean-Michel Pichavant wrote: Nigel Rantor wrote: Jean-Michel Pichavant wrote: Your solution will work, for sure. The problem is that it will dumb down the Base class interface, multiplying the number of methods by 2. This would not be an issue in many cases, in mine there's already too much

Re: Any way to adjust difflib algorithm?

2009-08-14 Thread Chris Rebert
On Fri, Aug 14, 2009 at 2:38 PM, Grant Edwards wrote: > I'm trying to use difflib to compare two files, and it's not > producing very useful results.  When comparing two lines where > only a few characters have changed, it usually seems to decide > that a line was deleted/inserted/replaced rather t

Re: Any way to adjust difflib algorithm?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Grant Edwards wrote: > I'm trying to use difflib to compare two files, and it's not > producing very useful results. When comparing two lines where > only a few characters have changed, it usually seems to decide > that a line was deleted/inserted/replaced rather than changed. [.

Re: callable virtual method

2009-08-14 Thread Dave Angel
Jean-Michel Pichavant wrote: Nigel Rantor wrote: Jean-Michel Pichavant wrote: Your solution will work, for sure. The problem is that it will dumb down the Base class interface, multiplying the number of methods by 2. This would not be an issue in many cases, in mine there's already too much

  1   2   >