Re: Python proficiency test

2006-07-23 Thread Ian Parker
In message [EMAIL PROTECTED], Richard Jones [EMAIL PROTECTED] writes Kent Johnson wrote: I recently helped create an on-line Python proficiency test. The publisher of the test is looking for beta testers to try the test and give feedback. If you are interested, here is an announcement from the

Re: Type signature

2006-07-23 Thread [EMAIL PROTECTED]
Yacao Wang wrote: Hi, I'm a newbie to Python. I've recently read some books about this language and none of them have answered my question. As a dynamically-typed language Python doesn't need any form of type signature which makes the syntax very clean and concise. However, type signatures

[Newbie] List from a generator function

2006-07-23 Thread Ernesto García García
Hi all, I'm sure there is a better way to do this: [random.choice(possible_notes) for x in range(length)] Regards, Ernesto -- http://mail.python.org/mailman/listinfo/python-list

Re: [Newbie] List from a generator function

2006-07-23 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Ernesto García García wrote: I'm sure there is a better way to do this: [random.choice(possible_notes) for x in range(length)] There is at least a better way to ask the question. The subject has nothing to do with the body of your post. Or am I missing something?

Re: Type signature

2006-07-23 Thread Paddy
Yacao Wang wrote: Hi, I'm a newbie to Python. I've recently read some books about this language and none of them have answered my question. As a dynamically-typed language Python doesn't need any form of type signature which makes the syntax very clean and concise. However, type signatures

Re: range() is not the best way to check range?

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Paul Boddie [EMAIL PROTECTED] wrote: Regardless of whether myslice inherits from object or not, there's no persuading the interpreter that it is a genuine slice, and remember that we can't subclass slice (for some reason unknown). So, it would appear that the interpreter really

Re: function v. method

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Antoon Pardon wrote: On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote: danielx wrote: (snip) if you prefix with a single underscore, that tells the user, DON'T MESS WITH ME FROM OUTSIDE! I AM AN IMPLEMENTATION DETAIL!

Re: function v. method

2006-07-23 Thread Antoon Pardon
On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Suppose I am writing my own module, I use an underscore, to mark variables which are an implementation detail for my module. Now I need to import an other module in my module and need access to an implementation

Re: [Newbie] List from a generator function

2006-07-23 Thread Ernesto García García
I'm sure there is a better way to do this: [random.choice(possible_notes) for x in range(length)] There is at least a better way to ask the question. The subject has nothing to do with the body of your post. Or am I missing something? Sorry, I should have explained better. I just want to

Re: Python proficiency test

2006-07-23 Thread Satya Kiran
I managed to take the test,though not it's entirety. I am still far being proficient in Python,but I really liked the thought-provoking questions in there. thanks so much. Kiran Satya On 7/23/06, Ian Parker [EMAIL PROTECTED] wrote: In message [EMAIL PROTECTED], Richard Jones [EMAIL

Re: Coding style

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On 21 Jul 2006 12:00:43 GMT, Antoon Pardon [EMAIL PROTECTED] declaimed the following in comp.lang.python: So we have code with certain shudder characteristics. And instead of trying to help the OP with his problem, some people react

Re: [Newbie] List from a generator function

2006-07-23 Thread Paul Rubin
Ernesto García García [EMAIL PROTECTED] writes: [random.choice(possible_notes) for x in range(length)] There is at least a better way to ask the question. The subject has nothing to do with the body of your post. Or am I missing something? Sorry, I should have explained better. I just

Re: [Newbie] List from a generator function

2006-07-23 Thread Peter Otten
Ernesto García García wrote: I'm sure there is a better way to do this: [random.choice(possible_notes) for x in range(length)] Note that generator has a fixed meaning in Python: http://www.python.org/dev/peps/pep-0255/ For generators you can use list(itertools.islice(gen()), length) What

Re: Coding style

2006-07-23 Thread Antoon Pardon
On 2006-07-21, Gerhard Fiedler [EMAIL PROTECTED] wrote: On 2006-07-21 09:00:43, Antoon Pardon wrote: So we have code with certain shudder characteristics. And instead of trying to help the OP with his problem, some people react to the shudder and come with all sort of comments that might be

Understanding Unicode encodings

2006-07-23 Thread Raphael . Benedet
Hello, For my application, I would like to execute an SQL query like this: self.dbCursor.execute(INSERT INTO track (name, nbr, idartist, idalbum, path) VALUES ('%s', %s, %s, %s, '%s') % (track, nbr, idartist, idalbum, path)) where the different variables are returned by the libtagedit python

Re: httplib, threading, wx app freezing after 4 hours

2006-07-23 Thread bryanjugglercryptographer
Mark rainess wrote: [...] It runs perfectly for about 4 hours, then freezes. I'm stuck. How do I debug this? [...] Can anyone suggest techniques to help me learn what is going on. By inspection: errcode is undefined; I expect you stripped the example a bit too far. If it is set to something

Re: httplib, threading, wx app freezing after 4 hours

2006-07-23 Thread Mark rainess
[EMAIL PROTECTED] wrote: Mark rainess wrote: [...] It runs perfectly for about 4 hours, then freezes. I'm stuck. How do I debug this? [...] Can anyone suggest techniques to help me learn what is going on. By inspection: errcode is undefined; I expect you stripped the example a bit too

Re: Understanding Unicode encodings

2006-07-23 Thread Jim
[EMAIL PROTECTED] wrote: Hello, For my application, I would like to execute an SQL query like this: self.dbCursor.execute(INSERT INTO track (name, nbr, idartist, idalbum, path) VALUES ('%s', %s, %s, %s, '%s') % (track, nbr, idartist, idalbum, path)) No, I'll bet that you'd like to run

Python for Lazarus (not Delphi)

2006-07-23 Thread Uwe Grauer
Does anyone know if something similar to Python for Delphi does exist for lazarus? Thanks for any pointers, Uwe -- http://mail.python.org/mailman/listinfo/python-list

Re: range() is not the best way to check range?

2006-07-23 Thread Paul Boddie
Antoon Pardon wrote: Except that if you write your own class from scratch, you can't use it as a slice. Correct, but we were actually discussing subclassing built-in classes for use as a replacement for range/xrange. :-) It may be hard work writing all those methods in a totally new

Re: function v. method

2006-07-23 Thread Gerhard Fiedler
On 2006-07-22 16:32:38, danielx wrote: ...and source code... *shudders* What happened to all the goodness of abstraction? Abstraction as you seem to use it requires complete docs of the interface. Which is what you said you don't have... So the original abstractor broke the abstraction

building lists of dictionaries

2006-07-23 Thread Jean_Francois Moulin
Hi all, I tried this piece of code (FWIW, it was taken as is from a help section of mpfit, a mathematical routine for least square fitting): parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6 parinfo[0]['fixed'] = 1 parinfo[4]['limited'][0] = 1 parinfo[4]['limits'][0] =

Re: Coding style

2006-07-23 Thread Gerhard Fiedler
On 2006-07-23 06:24:09, Antoon Pardon wrote: In general, I'd say that in this case the example was not well-chosen. After such a shudder removal, a poster should IMO review what caused the shudder, and rephrase the original problem without the shudder. The shudder is not with the poster.

Re: building lists of dictionaries

2006-07-23 Thread Ernesto García García
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6 With this, you are creating a list with 6 references to the same list. Note that the left operand of '*' is evaluated only once before multiplying it six times. Regards, Tito --

Re: building lists of dictionaries

2006-07-23 Thread Rob Williscroft
Jean_Francois Moulin wrote in news:[EMAIL PROTECTED] in comp.lang.python: Hi all, I tried this piece of code (FWIW, it was taken as is from a help section of mpfit, a mathematical routine for least square fitting): parinfo = [{'value':0., 'fixed':0, 'limited':[0,0],

Re: building lists of dictionaries

2006-07-23 Thread Tim Chase
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6 parinfo[0]['fixed'] = 1 parinfo[4]['limited'][0] = 1 parinfo[4]['limits'][0] = 50. The first line builds a list of six dictionaries with initialised keys. I expected that the last three lines would only

Re: building lists of dictionaries

2006-07-23 Thread Juho Schultz
Jean_Francois Moulin wrote: Hi all, I tried this piece of code (FWIW, it was taken as is from a help section of mpfit, a mathematical routine for least square fitting): parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}]*6 The first line builds a list of six

Re: Which Pyton Book For Newbies?

2006-07-23 Thread Cameron Laird
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: W. D. Allen wrote: I want to write a retirement financial estimating program. Python was suggested as the easiest language to use on Linux. I have some experience programming in Basic but not in Python. I have two questions: 1. What

Re: building lists of dictionaries

2006-07-23 Thread Juho Schultz
Tim Chase wrote: parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}.copy() for i in xrange(0,6)] However, this will still reference internal lists that have been referenced multiple times, such that parinfo[5]['limited'] [0, 0] parinfo[4]['limited'][0] = 2

Don't you hate it when your bed squeaks?

2006-07-23 Thread switzerland qunatium computer
Don't you hate it when your bed squeaks? http://www.beyond-science.com -- http://mail.python.org/mailman/listinfo/python-list

Machine intelligence- can this program be written ??

2006-07-23 Thread switzerland qunatium computer
Machine intelligence- can this program be written ?? Machine intelligence- can this program be written ?? In this game of chess it is a set of 7 chess boards The PAWN the pawn can move just like the regular game but up and down no levels The rook on the end moves all the way up and left

cherrypy tracing back all the time

2006-07-23 Thread Hari Sekhon
I've got a very simple script with cherrypy but for some reason the cherrypy server is constantly tracing back but it stays up, kind of, the performance etc though shows that something is wrong.import cherrypyimport threading def someFunc(): while 1: print workingthreading._start_new_thread(

Re: Which Pyton Book For Newbies?

2006-07-23 Thread danielx
W. D. Allen wrote: I want to write a retirement financial estimating program. Python was suggested as the easiest language to use on Linux. I have some experience programming in Basic but not in Python. I have two questions: 1. What do I need to be able to make user GUIs for the program,

Re: cherrypy tracing back all the time

2006-07-23 Thread Hari Sekhon
On 23/07/06, Hari Sekhon [EMAIL PROTECTED] wrote: I've got a very simple script with cherrypy but for some reason the cherrypy server is constantly tracing back but it stays up, kind of, the performance etc though shows that something is wrong.import cherrypy import threading def someFunc(): while

Re: Nested function scope problem

2006-07-23 Thread danielx
Bruno Desthuilliers wrote: Josiah Manson a écrit : I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only problem is that my little helper

Re: getaddrinfo not found on SCO OpenServer 5.0.5

2006-07-23 Thread edcdave
Martin v. Löwis wrote: [EMAIL PROTECTED] wrote: 1) I've seen mention of native vs. Python getaddrinfo implementations. If that's true, how can I force the program to use the Python one? 2) Is there an option to not use the BSD Library function? 3) Finally, is there a trick to

Referring to Interpreter (Jython)

2006-07-23 Thread wojciech
Hi everyone, I apologize if this is a bit off-topic. I am currently working on a Java-based application that is used Jython as a scripting language within the actual program. However, for one of my GUI elements, I need to pass the actual PythonInterpeter to the constructor. I know that in Java

Re: Understanding Unicode encodings

2006-07-23 Thread clarkcb
[EMAIL PROTECTED] wrote: I tried to encode the different variables in many different encodings (latin1), but I always get an exception. Where does this ascii codec error comes from? How can I simply build this query string? Raphael, The 'ascii' encoding is set in the python library file

Re: Referring to Interpreter (Jython)

2006-07-23 Thread wojciech
Hi everyone, Ah, after some more searching and programming, I got it: PythonInterpreter py = new PythonInterpreter(); py.set(interpreter, py); Thanks, Wojciech [EMAIL PROTECTED] wrote: Hi everyone, I apologize if this is a bit off-topic. I am currently working on a Java-based application

Re: Nested function scope problem

2006-07-23 Thread Gerhard Fiedler
On 2006-07-23 14:53:33, danielx wrote: I can't figure out why Josiah's breakLine function won't work either. I know Josiah has had his problem resolved, but I'd still like to know why his func won't work. I'd like to redirect this discussion in that direction, if I may. I think what happens

Re: Python for Lazarus (not Delphi)

2006-07-23 Thread Ravi Teja
Uwe Grauer wrote: Does anyone know if something similar to Python for Delphi does exist for lazarus? Thanks for any pointers, Uwe Python for Delphi does support Lazarus since Version 3.29 http://mmm-experts.com/VersionHistory.aspx?ProductId=3 --

Generating all possible combination of elements in a list

2006-07-23 Thread Mir Nazim
Hello, I need to write scripts in which I need to generate all posible unique combinations of an integer list. Lists are a minimum 12 elements in size with very large number of possible combination(12!) I hacked a few lines of code and tried a few things from Python CookBook

How to generate geometric random numbers?

2006-07-23 Thread MyInfoStation
Hi all, I am a newbie to Python and would like to genereate some numbers according to geometric distribution. However, the Python Random package seems do not have implemented functionality. I am wondering is there exist any other libraries that can do this job? Thanks a lot, Da --

Re: [Newbie] List from a generator function

2006-07-23 Thread Ernesto García García
Thank you guys. So the answer is to keep with the original form, perhaps with xrange. Ernesto -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate geometric random numbers?

2006-07-23 Thread Robert Kern
Gerhard Fiedler wrote: On 2006-07-23 17:12:20, [EMAIL PROTECTED] wrote: I am a newbie to Python and would like to genereate some numbers according to geometric distribution. However, the Python Random package seems do not have implemented functionality. I am wondering is there exist any

Re: building lists of dictionaries

2006-07-23 Thread Ernesto García García
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}.copy() for i in xrange(0,6)] However, this will still reference internal lists that have been referenced multiple times, such that parinfo[5]['limited'] [0, 0] parinfo[4]['limited'][0] = 2 parinfo[5]['limited'] [2, 0]

Re: How to force a thread to stop

2006-07-23 Thread M�ta-MCI
Hi! threadicide method I like this word... Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: building lists of dictionaries

2006-07-23 Thread Tim Chase
parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], 'limits':[0.,0.]}.copy() for i in xrange(0,6)] However, this will still reference internal lists that have been referenced multiple times, such that parinfo[5]['limited'] [0, 0] parinfo[4]['limited'][0] = 2 parinfo[5]['limited'] [2, 0]

find_longest_match in SequenceMatcher

2006-07-23 Thread koara
Hello, it might be too late or too hot, but i cannot work out this behaviour of find_longest_match() in difflib.SequenceMatcher: string1:

Re: Understanding Unicode encodings

2006-07-23 Thread John Machin
Jim wrote: [EMAIL PROTECTED] wrote: Hello, For my application, I would like to execute an SQL query like this: self.dbCursor.execute(INSERT INTO track (name, nbr, idartist, idalbum, path) VALUES ('%s', %s, %s, %s, '%s') % (track, nbr, idartist, idalbum, path)) No, I'll bet that you'd

Grail not downloading

2006-07-23 Thread Dustan
Does anybody know anything about Grail? I've been unable to get at it, and I've tried on both Windows and Macintosh machines. http://grail.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating all possible combination of elements in a list

2006-07-23 Thread Martin v. Löwis
Mir Nazim wrote: Example Problem: Generate all possible permutations for [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2] [1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2] (notice an extra 2 ) eliminate some combinations based on some conditions and combine the rest of combinations. And now generate all

Re: Grail not downloading

2006-07-23 Thread Martin v. Löwis
Dustan wrote: Does anybody know anything about Grail? I've been unable to get at it, and I've tried on both Windows and Macintosh machines. http://grail.sourceforge.net/ The files just don't exist, physically, on the server (if you have an SF account, you can check this yourself). However,

Re: Track keyboard and mouse usage

2006-07-23 Thread dfaber
Hi Francois, Thank you for providing me the evdev link! That was exactly what I was looking for. Instead of sudo'ing the script, I changed /dev/input/ directory to be world readable. After that, I had to change the way a file was accessed in evdev.py to: Line No: 91 #self.fd =

Re: Understanding Unicode encodings

2006-07-23 Thread John Machin
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I tried to encode the different variables in many different encodings (latin1), but I always get an exception. Where does this ascii codec error comes from? How can I simply build this query string? Raphael, The 'ascii' encoding is set

Re-evaluating a string?

2006-07-23 Thread bugnthecode
I'm writing a program to send data over the serial port. I'm using pyserial, and I'm on WindowsXP. When I use literals I can get the data accross how I want it for example: 1 2 3 4 5 6 serialport.write('!SC'+'\x01'+'\x05'+'\xFA'+'\x00'+'\r') 1=Get

url encode latin-1 characters

2006-07-23 Thread Lurker
I want send latin-1 string to web server by url parameter urllib.quote return just symbol code with preceeding percent for every non-ascii character: #ustr = 'Ü' #urllib.quote(ustr) '%9A' but this seems to be wrong because server response contains my parameter and it differ from original (for

MULTI-DIMENTIONAL CHESS DOWNLOAD FROM DEEP SPACE

2006-07-23 Thread switzerland qunatium computer
MULTI-DIMENTIONAL CHESS DOWNLOAD FROM DEEP SPACE HTTP://WWW.BEYOND-SCIENCE.COM -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-evaluating a string?

2006-07-23 Thread Tim Chase
serialport.write('!SC'+'\x01'+'\x05'+'\xFA'+'\x00'+'\r') [cut] My problem is that the write() function only takes a string, and I want to substitute variables for the hex literals. Well, you can try something like import types def makeString(a): ... return ''.join([type(x) !=

Re: Re-evaluating a string?

2006-07-23 Thread John Machin
bugnthecode wrote: I'm writing a program to send data over the serial port. I'm using pyserial, and I'm on WindowsXP. When I use literals I can get the data accross how I want it for example: 1 2 3 4 5 6

easy questions from python newbie

2006-07-23 Thread walterbyrd
This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I will start with a file like: 1001 1012 1008 1012 1001 1001

Re: Which Pyton Book For Newbies?

2006-07-23 Thread Simon Forman
W. D. Allen wrote: I want to write a retirement financial estimating program. Python was suggested as the easiest language to use on Linux. I have some experience programming in Basic but not in Python. I have two questions: 1. What do I need to be able to make user GUIs for the program,

Re: Track keyboard and mouse usage

2006-07-23 Thread Simon Forman
Dennis Lee Bieber wrote: On 17 Jul 2006 21:00:09 -0700, dfaber [EMAIL PROTECTED] declaimed the following in comp.lang.python: Is there no clean method of accessing the keyboard device or the mouse on linux? It seems that looking at /proc/interrupts might prove to be useful for keyboard

Re: Re-evaluating a string?

2006-07-23 Thread bugnthecode
Thanks Tim, and John for your quick responses! Tim, I tested your function and it works! Though I don't completely understand how. Could you possibly explain this? John, I test your MEDUIM_WAYand it works as well. How is it that putting the string together this way translates into a hex value to

Re: url encode latin-1 characters

2006-07-23 Thread John Machin
Lurker wrote: I want send latin-1 string to web server by url parameter urllib.quote return just symbol code with preceeding percent for every non-ascii character: #ustr = 'Ü' #urllib.quote(ustr) '%9A' The latin1 encoding for U-with-umlaut is 0xDC. The cp850 encoding for the same is

Re: Isn't there a better way?

2006-07-23 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : If you're calling a number of different routines in the Processor class, all accessing the same data, then it makes perfect sense to only pass it once. Actually they are not passed. I think I'm going

Re: Understanding Unicode encodings

2006-07-23 Thread Jim
John Machin wrote: Jim wrote: No, I'll bet that you'd like to run something like self.dcCursor.execute(INSERT INTO track (name, nbr, idartist, idalbum,path) VALUES (%(track)s, %(nbr)s, %(idartist)s,%(idalbum)s,'%(path)s'),

Re: easy questions from python newbie

2006-07-23 Thread James Stroud
walterbyrd wrote: This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I will start with a file like: 1001

Re: Re-evaluating a string?

2006-07-23 Thread John Machin
bugnthecode wrote: Thanks Tim, and John for your quick responses! Tim, I tested your function and it works! Though I don't completely understand how. Could you possibly explain this? John, I test your MEDUIM_WAYand it works as well. Now try the struct module approach. Are you 100% certain

Re: Re-evaluating a string?

2006-07-23 Thread Tim Chase
Thanks Tim, and John for your quick responses! This is one of the better lists for getting quick (and usually helpful) responses. Tim, I tested your function and it works! Though I don't completely understand how. Could you possibly explain this? def makeString(a): ... return

Re: Understanding Unicode encodings

2006-07-23 Thread John Machin
Jim wrote: John Machin wrote: Jim wrote: No, I'll bet that you'd like to run something like self.dcCursor.execute(INSERT INTO track (name, nbr, idartist, idalbum,path) VALUES (%(track)s, %(nbr)s, %(idartist)s,%(idalbum)s,'%(path)s'),

Re: How to generate geometric random numbers?

2006-07-23 Thread MyInfoStation
Robert Kern wrote: Gerhard Fiedler wrote: On 2006-07-23 17:12:20, [EMAIL PROTECTED] wrote: I am a newbie to Python and would like to genereate some numbers according to geometric distribution. However, the Python Random package seems do not have implemented functionality. I am wondering

Re: easy questions from python newbie

2006-07-23 Thread John Machin
James Stroud wrote: walterbyrd wrote: This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I will

Re: easy questions from python newbie

2006-07-23 Thread James Stroud
John Machin wrote: James Stroud wrote: walterbyrd wrote: This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I

Re: How to generate geometric random numbers?

2006-07-23 Thread Paul Rubin
[EMAIL PROTECTED] writes: But I am still surprised because the default Random package in Python can generate so few discrete random distritbuions, while it can generate quite a few continuous distribution, including some not very common one. It looks pretty simple to transform the uniform

Re: How to generate geometric random numbers?

2006-07-23 Thread Paul Rubin
Paul Rubin http://[EMAIL PROTECTED] writes: n = log(c, 1-p) - 1 I meantn = log(c/p, 1-p) - 1 sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate geometric random numbers?

2006-07-23 Thread Robert Kern
Paul Rubin wrote: Paul Rubin http://[EMAIL PROTECTED] writes: n = log(c, 1-p) - 1 I meantn = log(c/p, 1-p) - 1 sorry. import random from math import ceil, log def geometric(p): Geometric distribution per Devroye, Luc. _Non-Uniform Random Variate Generation_, 1986, p 500.

Re: How to generate geometric random numbers?

2006-07-23 Thread Paul Rubin
Robert Kern [EMAIL PROTECTED] writes: G = int(ceil(log(U) / log(1.0 - p))) I usually owuld write that as int(ceil(log(U, 1.0 - p))). -- http://mail.python.org/mailman/listinfo/python-list

Re: find_longest_match in SequenceMatcher

2006-07-23 Thread John Machin
koara wrote: Hello, it might be too late or too hot, but i cannot work out this behaviour of find_longest_match() in difflib.SequenceMatcher: string1: [snipped 500-byte string] string2: [snipped 500-byte string] find_longest_match(0,500,0,500)=(24,43,10)=version01t What? O_o Clearly

Re: easy questions from python newbie

2006-07-23 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], walterbyrd wrote: This is the first real python program I have ever worked on. What I want to do is: 1) count identical records in a cvs file 2) create a new file with quantities instead duplicate records 3) open the new file in ms-excel For example, I will start

[ python-Bugs-1525447 ] Build fails on OS X with case sensitive fs

2006-07-23 Thread SourceForge.net
Bugs item #1525447, was opened at 2006-07-19 19:24 Message generated for change (Comment added) made by ronaldoussoren You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1525447group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1517996 ] IDLE (macosx): Class and Path browsers show Tk menu

2006-07-23 Thread SourceForge.net
Bugs item #1517996, was opened at 2006-07-06 10:34 Message generated for change (Comment added) made by ronaldoussoren You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1517996group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1517996 ] IDLE (macosx): Class and Path browsers show Tk menu

2006-07-23 Thread SourceForge.net
Bugs item #1517996, was opened at 2006-07-06 10:34 Message generated for change (Comment added) made by ronaldoussoren You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1517996group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1527397 ] PythonLauncher uses incorrect working directory

2006-07-23 Thread SourceForge.net
Bugs item #1527397, was opened at 2006-07-23 13:29 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1527397group_id=5470 Please note that this message will contain a full copy of

[ python-Bugs-1525447 ] Build fails on OS X with case sensitive fs

2006-07-23 Thread SourceForge.net
Bugs item #1525447, was opened at 2006-07-19 19:24 Message generated for change (Comment added) made by ronaldoussoren You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1525447group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1527397 ] PythonLauncher uses incorrect working directory

2006-07-23 Thread SourceForge.net
Bugs item #1527397, was opened at 2006-07-23 19:29 Message generated for change (Comment added) made by ronaldoussoren You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1527397group_id=5470 Please note that this message will contain a full copy of the

[ python-Bugs-1436532 ] length of unicode string changes print behaviour

2006-07-23 Thread SourceForge.net
Bugs item #1436532, was opened at 2006-02-22 10:45 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1436532group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1525678 ] exec and eval allocate lots of memory and do not free it

2006-07-23 Thread SourceForge.net
Bugs item #1525678, was opened at 2006-07-20 05:57 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1525678group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1524938 ] MemoryError with a lot of available memory - gc not called

2006-07-23 Thread SourceForge.net
Bugs item #1524938, was opened at 2006-07-19 04:46 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1524938group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1524938 ] MemoryError with a lot of available memory - gc not called

2006-07-23 Thread SourceForge.net
Bugs item #1524938, was opened at 2006-07-19 05:46 Message generated for change (Comment added) made by markmat You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1524938group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1524938 ] MemoryError with a lot of available memory - gc not called

2006-07-23 Thread SourceForge.net
Bugs item #1524938, was opened at 2006-07-19 05:46 Message generated for change (Comment added) made by markmat You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1524938group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1524938 ] PEP MemoryError with a lot of available memory gc not called

2006-07-23 Thread SourceForge.net
Bugs item #1524938, was opened at 2006-07-19 05:46 Message generated for change (Settings changed) made by markmat You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1524938group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1012435 ] ctrl-left/-right works incorectly with diacritics

2006-07-23 Thread SourceForge.net
Bugs item #1012435, was opened at 2004-08-19 15:40 Message generated for change (Comment added) made by kbk You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1012435group_id=5470 Please note that this message will contain a full copy of the comment thread,

[ python-Bugs-1512124 ] OSX: debugger hangs IDLE

2006-07-23 Thread SourceForge.net
Bugs item #1512124, was opened at 2006-06-25 09:45 Message generated for change (Comment added) made by kbk You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1512124group_id=5470 Please note that this message will contain a full copy of the comment thread,

[ python-Feature Requests-1510853 ] Add Windows 9x/ME (lack of) support information to README.TX

2006-07-23 Thread SourceForge.net
Feature Requests item #1510853, was opened at 2006-06-22 20:36 Message generated for change (Settings changed) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=1510853group_id=5470 Please note that this message will contain a full copy of the