Re: Any idea to emulate tail -f

2009-05-04 Thread CTO
On May 5, 2:00 am, Joel Juvenal Rivera Rivera wrote: > I want to make something very similar to  the command tail -f (follow a > file), i have been trying  with some while True and some microsleeps > (about .1 s); did someone has already done something like this? > > And about the file is the apac

Re: Self function

2009-05-04 Thread Chris Rebert
On Mon, May 4, 2009 at 11:08 PM, Steven D'Aprano wrote: > On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: > >> bearophileh...@lycos.com wrote: >> >>> Another possible syntax: >>> >>> def fact(n): >>>     return 1 if n <= 1 else n * return(n - 1) >>> >>> But I guess most people don't see thi

Which one is best Python or Java for developing GUI applications?

2009-05-04 Thread srinivasan srinivas
Could you tell me does Python have any advantages over Java for the development of GUI applications? Thanks, Srini Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/?fr=om_email_firefox -- http://mail.python.org/mailman/list

Re: Self function

2009-05-04 Thread Carl Banks
On May 4, 8:22 pm, Steven D'Aprano wrote: > On Mon, 04 May 2009 15:51:15 -0700, Carl Banks wrote: > > All > > recursion does it make what you're doing a lot less readable for almost > > all programmers. > > What nonsense. It's not nonsense for a singly-linked list. I don't need to be taught the

Re: Self function

2009-05-04 Thread Steven D'Aprano
On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: > bearophileh...@lycos.com wrote: > >> Another possible syntax: >> >> def fact(n): >> return 1 if n <= 1 else n * return(n - 1) >> >> But I guess most people don't see this problem as important&common >> enough to justify changing the l

Any idea to emulate tail -f

2009-05-04 Thread Joel Juvenal Rivera Rivera
I want to make something very similar to the command tail -f (follow a file), i have been trying with some while True and some microsleeps (about .1 s); did someone has already done something like this? And about the file is the apache acceslog of a site with a lot of traffic. Regards joe

Re: subprocess & shared environments

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 23:25:42 -0300, Robert Dailey escribió: Thanks for your help guys. Unfortunately both ideas will not work. I guess I should have mentioned that the batch file in question is vsvars32.bat, from the Visual Studio installation directory. I should not modify this file, nor can

Re: Question of UTF16BE encoding / decoding

2009-05-04 Thread Mark Tolonen
"Napalmski" wrote in message news:mpg.2469d7edf8bbcd0a989...@eu.news.astraweb.com... Hello, I have an encoded string in the form "004e006100700061006c006d", if you split on every 4 characters it decodes to a single character. I have come up with this: name = '004e006100700061006c006d' name2

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 11:01 pm, Ross wrote: > Anyways, I'm new to > programming and this has been a good learning experience. I'm glad that you've been trying, and seem to be sticking it out despite sometimes getting negative feedback here. > Next time around, I'll be sure to thoroughly comment > my code be

Question of UTF16BE encoding / decoding

2009-05-04 Thread Napalmski
Hello, I have an encoded string in the form "004e006100700061006c006d", if you split on every 4 characters it decodes to a single character. I have come up with this: name = '004e006100700061006c006d' name2 = "" for x in range(0, len(name), 4): name2 = name2 + chr(int(name[x:x+4], 16)) Is t

Re: local module-docs server on Linux?

2009-05-04 Thread CTO
On May 4, 10:30 pm, Soumen banerjee wrote: > Hello, > I had used python on windows and one of the features i liked best was > that you could start a module-docs server and then use firefox to > access it. pydoc -p -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with case insensitive volumes

2009-05-04 Thread Dave Angel
dmoore wrote: Does anyone know of a way to get the unique pathname for files stored on FAT32 or other case insensitive drives? For example: os.path.samefile('/media/usbkey/file1.jpg','/media/usbkey/FILE1.jpg') returns True but, is there a simple way to determine whether '/media/usbkey/ file1.

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Alex Jurkiewicz
Piet van Oostrum wrote: AJ> if __name__ == '__main__': AJ>THREADS = [] AJ>for i in range(CONCURRENCY): AJ>THREADS.append(threading.Thread(target=threadProcessRecipient)) AJ>for thread in THREADS: AJ>thread.run() You should use thread.start(), not thread.run(). W

Re: Self function

2009-05-04 Thread Steven D'Aprano
On Mon, 04 May 2009 16:33:13 -0700, Carl Banks wrote: > On May 4, 4:06 pm, bearophileh...@lycos.com wrote: >> Carl Banks: >> >> >1. Singly-linked lists can and should be handled with iteration.< >> >> I was talking about a binary tree with list-like topology, of course. > > "(every node has 1 chi

Problem with case insensitive volumes

2009-05-04 Thread dmoore
Does anyone know of a way to get the unique pathname for files stored on FAT32 or other case insensitive drives? For example: os.path.samefile('/media/usbkey/file1.jpg','/media/usbkey/FILE1.jpg') returns True but, is there a simple way to determine whether '/media/usbkey/ file1.jpg' or '/media/

Re: Self function

2009-05-04 Thread Steven D'Aprano
On Mon, 04 May 2009 15:51:15 -0700, Carl Banks wrote: > All > recursion does it make what you're doing a lot less readable for almost > all programmers. What nonsense. There are many algorithms that are more understandable written recursively than iteratively -- consult any good text book for e

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:33 pm, John Yeung wrote: > On May 4, 8:56 pm, Ross wrote: > > > Anyways, you're right that seq[0] is always evaluated. > > That's why my algorithm works fine when there are odd > > numbers of players in a league. > > It doesn't work fine for all odd numbers of players.  For example, 1

Re: local module-docs server on Linux?

2009-05-04 Thread David Lyon
Hi Soumen, You could try running the Python Package Manager that we are developing on sourceforge. There isn't a release yet but we have implemented two buttons inside the program for 'Examples' and 'Documentation'. What they do is go off and find any documentation files or example directories f

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 8:56 pm, Ross wrote: > Anyways, you're right that seq[0] is always evaluated. > That's why my algorithm works fine when there are odd > numbers of players in a league. It doesn't work fine for all odd numbers of players. For example, 15 players on 3 courts should result in 5 byes. Bu

local module-docs server on Linux?

2009-05-04 Thread Soumen banerjee
Hello, I had used python on windows and one of the features i liked best was that you could start a module-docs server and then use firefox to access it. This would show module-docs for all modules you had installed(including any 3rd party installs) . How do i do this on linux? regards Soumen -- ht

Re: subprocess & shared environments

2009-05-04 Thread Robert Dailey
On May 1, 4:18 pm, Aaron Brady wrote: > On May 1, 12:09 am, Robert Dailey wrote: > > > I'm currently calling subprocess.call() on a batch file (in Windows) > > that sets a few environment variables that are needed by further > > processes started via subprocess.call(). How can I persist the > > e

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:59 pm, John Yeung wrote: > On May 4, 10:01 am, Ross wrote: > > > The "magic numbers" that everyone is wondering about are > > indeed used for spreading out the bye selection and I got > > them by simply calculating a line of best fit when plotting > > several courts: byes ratios. > >

RE: sorting items in a table problematic because of scientific notation

2009-05-04 Thread Davis, Amelie Y
Thank you _ that solved it.   Amélie    Please consider the environment before printing this e-mail or any of its attachments (if applicable)   -Original Message- From: python-list-bounces+aydavis=purdue@python.org [mailto:python-list-bounces+aydavis=purdue@python.org] On Be

Re: Tkinter, Trouble with Message,Label widget

2009-05-04 Thread norseman
definitive on Toplevel was the biggest help. All I have read have never clearly stated its purpose. (A non-root root) per Tkinter help: "class Toplevel(BaseWidget, Wm) Toplevel widget, e.g. for dialogs. ... " Since I'm not doing dialogs, I quite reading and move on. John: Thank you again. Today: 20090504 copy/paste from Python 2.5.2 on Linux Slackware 10.2 Steve norse...@hughes.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 10:01 am, Ross wrote: > The "magic numbers" that everyone is wondering about are > indeed used for spreading out the bye selection and I got > them by simply calculating a line of best fit when plotting > several courts: byes ratios. But that doesn't really help you. When you do seq[::

Re: Database help needed

2009-05-04 Thread CTO
On May 4, 7:51 pm, Emile van Sebille wrote: > On 5/4/2009 4:30 PM Amber said... > > > > > > > My PHB is insane. > > > Today he drops 50,000 databases in MS Access format on my desk, and > > tells me that by Friday I need to: > > * Remove all of the "junk content" in the record fields; > > * Remove

Re: Database help needed

2009-05-04 Thread Emile van Sebille
On 5/4/2009 4:30 PM Amber said... My PHB is insane. Today he drops 50,000 databases in MS Access format on my desk, and tells me that by Friday I need to: * Remove all of the "junk content" in the record fields; * Remove all records with blank fields in them; * Correct all fields in which the

Re: Self function

2009-05-04 Thread Carl Banks
On May 4, 4:06 pm, bearophileh...@lycos.com wrote: > Carl Banks: > > >1. Singly-linked lists can and should be handled with iteration.< > > I was talking about a binary tree with list-like topology, of course. "(every node has 1 child, and they are chained)" That's a singly-linked list, not a tre

Database help needed

2009-05-04 Thread Amber
My PHB is insane. Today he drops 50,000 databases in MS Access format on my desk, and tells me that by Friday I need to: * Remove all of the "junk content" in the record fields; * Remove all records with blank fields in them; * Correct all fields in which the markup is "wrong"; * Correct all field

Re: Self function

2009-05-04 Thread bearophileHUGS
Carl Banks: >1. Singly-linked lists can and should be handled with iteration.< I was talking about a binary tree with list-like topology, of course. >All recursion does it make what you're doing a lot less readable for almost >all programmers.< I can't agree. If the data structure is recursiv

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Ben Finney
Soumen banerjee writes: > Is there any IDE with support for autocomplete in python 2.6 with all > the newer functions included? Emacs, with the right library, is an excellent Python IDE with auto-completion and many other features http://tellarite.net/2008/05/09/emacs-as-a-powerful-python-ide/>.

Re: Self function

2009-05-04 Thread Carl Banks
On May 4, 1:25 pm, bearophileh...@lycos.com wrote: > Aahz: > > > When have you ever had a binary tree a thousand levels deep? > > Yesterday. > > >Consider how big 2**1000 is...< > > You are thinking just about complete binary trees. > But consider that a topology like a single linked list (every no

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Scott David Daniels
MRAB wrote: If you're not limited to ASCII then there's '←' (U+2190, 'LEFTWARDS ARROW'). It's a little too late now, though. Well, if you are old enough, that was the ASCII graphic for the character now printed as '_' (ASCII), and SAIL used it for assignment statements, causing much consternatio

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Terry Reedy
Antoon Pardon wrote: On 2009-04-24, Steven D'Aprano wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test(): return 'Vla' I searching

Re: exit a program gracefully

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 19:14:53 -0300, Chris Rebert escribió: On Mon, May 4, 2009 at 3:02 PM, wrote: In a python program I ask if the user wants to continue.  If they answer 'no', what options do I have to halt execution?  I can put the rest of the code inside an "if bContinue:" block, but th

Re: Self function

2009-05-04 Thread Scott David Daniels
Arnaud Delobelle wrote: In that case the following would not grow the stack, given tail-call optimization: def visit(node): print 'visiting', node if node.right is None: return visit(node.left) if node.left is not None: visit(node.left) return visit(node.right)

Re: [ANN] regobj - Pythonic object-based access to the Windows Registry

2009-05-04 Thread Ryan Kelly
> > I've just released the results of a nice Sunday's coding, inspired by > > one too many turns at futzing around with the _winreg module. The > > "regobj" module brings a convenient and clean object-based API for > > accessing the Windows Registry. > > Sounds very interesting, Ryan. Just a c

Re: Most Basic Question Ever - please help

2009-05-04 Thread seanm . py
On May 3, 12:22 am, CM wrote: > On May 2, 4:36 pm, seanm...@gmail.com wrote: > > > > > I am going to try posting here again with more detail to see if I can > > finally get my first program to work. > > > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window > > in IDLE to create

Re: exit a program gracefully

2009-05-04 Thread MRAB
robert.t.ly...@seagate.com wrote: In a python program I ask if the user wants to continue. If they answer 'no', what options do I have to halt execution? I can put the rest of the code inside an "if bContinue:" block, but that seems awkward. I have looked at raising an exception, and perha

Re: AutoComplete in C++ Editor for Python

2009-05-04 Thread Scott David Daniels
flam...@gmail.com wrote: ... Using this code, I can get information like the name of the symbol (x), but I can't figure out how to get the type. If I knew how to get this it would solve 99% of my problems :) If Python were statically typed, you might be correct. A _value_ in python has a type,

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread MRAB
Rhodri James wrote: On Mon, 04 May 2009 15:25:44 +0100, Antoon Pardon wrote: On 2009-04-24, Steven D'Aprano wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , w

Re: exit a program gracefully

2009-05-04 Thread Chris Rebert
On Mon, May 4, 2009 at 3:02 PM, wrote: > > In a python program I ask if the user wants to continue.  If they answer > 'no', what options do I have to halt execution?  I can put the rest of the > code inside an "if bContinue:" block, but that seems awkward.  I have looked > at raising an exception

exit a program gracefully

2009-05-04 Thread Robert . T . Lynch
In a python program I ask if the user wants to continue. If they answer 'no', what options do I have to halt execution? I can put the rest of the code inside an "if bContinue:" block, but that seems awkward. I have looked at raising an exception, and perhaps this is the preferred method, but

Re: find sublist inside list

2009-05-04 Thread Terry Reedy
Matthias Gallé wrote: Hi. My problem is to replace all occurrences of a sublist with a new element. Example: Given ['a','c','a','c','c','g','a','c'] I want to replace all occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). If I do this with string ('acaccgac') I have the advantage of all

Re: Self function

2009-05-04 Thread Terry Reedy
bearophileh...@lycos.com wrote: Another possible syntax: def fact(n): return 1 if n <= 1 else n * return(n - 1) But I guess most people don't see this problem as important&common enough to justify changing the language. Actually, I would like a way to refer to the current function from

Re: find sublist inside list

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 15:12:41 -0300, mzdude escribió: substring isn't limited to 0..255 substring = "\0x%d\0x%d" % (257,257) 'acaccgac'.replace("ac", substring) '\x00x257\x00x257\x00x257\x00x257cg\x00x257\x00x257' This isn't what you think it is. Look carefully: py> substring = "\0x%d\0x%d"

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Rhodri James
On Mon, 04 May 2009 15:25:44 +0100, Antoon Pardon wrote: On 2009-04-24, Steven D'Aprano wrote: On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it

Re: Self function

2009-05-04 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: > Aahz: >> When have you ever had a binary tree a thousand levels deep? > > Yesterday. > > >>Consider how big 2**1000 is...< > > You are thinking just about complete binary trees. > But consider that a topology like a single linked list (every node has > 1 child, a

Re: SYSTEM and USER environment (was Your confirmation is required to join the Python-list mailing list)

2009-05-04 Thread Dave Angel
Allan Yuan wrote: Hi, I just wanna know how to set SYSTEM variables and USER variables of windows, but got no way. Firstly I thought "os.environ + os.system" may work well, but found no way to let "os.environ" run to retrive USER variables. Then I tried win32api, finding the GetEnvironmentVaria

Re: Is there is any way to send messages to chunk of emails ID's concurrently using smptlib

2009-05-04 Thread Piet van Oostrum
> gganesh (g) wrote: >g> Hi friends, >g> I suppose sendmail() can send mails one by one ,how to send mails >g> concurrently , >g> It would be very grateful,if someone could point out a solution. There is a discussion about this in the thread `Threaded alternatives to smtplib?' -- Piet van

Re: Self function

2009-05-04 Thread Chris Rebert
On Mon, May 4, 2009 at 1:25 PM, wrote: > Aahz: >> When have you ever had a binary tree a thousand levels deep? > > Yesterday. > > >>Consider how big 2**1000 is...< > > You are thinking just about complete binary trees. > But consider that a topology like a single linked list (every node has > 1 c

Re: change some lines from a read file

2009-05-04 Thread norseman
watch out for: for i in file... often returns just one character at a time, meaning you will have to track EOL's yourself OR import the readline and use it to stand a better chance of getting what you expect from a read file function. Today: 20090504 Logic outline, No particular versio

Re: change some lines from a read file

2009-05-04 Thread norseman
watch out for: for i in file... often returns just one character at a time, meaning you will have to track EOL's yourself OR import the readline and use it to stand a better chance of getting what you expect from a read file function. Today: 20090504 Logic outline, No particular version

Re: Threaded alternatives to smtplib?

2009-05-04 Thread Piet van Oostrum
> Alex Jurkiewicz (AJ) wrote: >AJ> def threadProcessRecipient(): [snip] >AJ> if __name__ == '__main__': >AJ>THREADS = [] >AJ>for i in range(CONCURRENCY): >AJ>THREADS.append(threading.Thread(target=threadProcessRecipient)) >AJ>for thread in THREADS: >AJ>thread.run()

Re: How to walk up parent directories?

2009-05-04 Thread Dave Angel
Matthew Wilson wrote: On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote: Not every simple function belongs in the standard library :-) Thanks for the help with this! Maybe I'm overestimating how often people need this walkup function. Matt Look at os.path.normpath(os.path.j

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Dave Angel
Soumen banerjee wrote: Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as autocomplete options. Is there any IDE with support for autocomplet

Re: AutoComplete in C++ Editor for Python

2009-05-04 Thread Dave Angel
flam...@gmail.com wrote: On May 3, 3:14 pm, Dave Angel wrote: flam...@gmail.com wrote: Hello, I am embedding python support in my C++ application and was looking at adding "Intellisense" or "AutoComplete" support. I found a way to do it using the "dir" function, but this creates

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 12:15 pm, a...@pythoncraft.com (Aahz) wrote: > In article <8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com>, > > Ross   wrote: > > >def test_round_robin(players, rounds, courts, doubles = False): > >    players = range(players) > >    for week in round_robin(players,round

Re: Self function

2009-05-04 Thread bearophileHUGS
Aahz: > When have you ever had a binary tree a thousand levels deep? Yesterday. >Consider how big 2**1000 is...< You are thinking just about complete binary trees. But consider that a topology like a single linked list (every node has 1 child, and they are chained) is a true binary tree still.

Re: Self function

2009-05-04 Thread Tim Wintle
On Mon, 2009-05-04 at 19:51 +0100, Arnaud Delobelle wrote: > > Bearophile, there is a thread on python-ideas about tail-call > optimization at the moment. Oooh - haven't noticed that (and don't have time to follow it), but has anyone seen the results I got a week or so ago from briefly playing wi

Re: yet another list comprehension question

2009-05-04 Thread namekuseijin
On May 4, 9:15 am, David Robinow wrote: > On Mon, May 4, 2009 at 2:33 AM, namekuseijin > > wrote: > ls = [(1,2), (3,4), (5, None), (6,7), (8, None)] > [(x,y) for (x,y) in ls if y] > > [(1, 2), (3, 4), (6, 7)] > > Nope. That filters out 0 as well as None. Not what the OP asked for. True

Re: change some lines from a read file

2009-05-04 Thread Anthra Norell
utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to decide

Re: Personal recommendations for Python and Django on-boarding materials

2009-05-04 Thread Arnaud Delobelle
Grant Rettke writes: > Hi folks, > > From one developer to another, I am looking for some personal > recommendations on what are the best materials for fast tracking an on- > boarding to Python and Django. > > I know how to program, get web apps and OO; this is the audience. > > I have found some

Re: Self function

2009-05-04 Thread Aahz
In article , wrote: >Arnaud Delobelle: >> >> Bearophile, there is a thread on python-ideas about tail-call >> optimization at the moment. > >Someday I'll have to start following those mailing lists... >But I am not interested in such optimization. It's not going to help >me significantly. Most t

Re: Self function

2009-05-04 Thread bearophileHUGS
Arnaud Delobelle: > def fac(n): >     def rec(n, acc): >         if n <= 1: >             return acc >         else: >             return rec(n - 1, n*acc) >     return rec(n, 1) Right, that's another way to partially solve the problem I was talking about. (Unfortunately the performance in Python

Re: change some lines from a read file

2009-05-04 Thread MRAB
utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to decide

Re: Self function

2009-05-04 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: > Steve Howell: >>two methods with almost identical names, where one function is the >>public interface and then another method that does most of the >>recursion.< > > Thanks Guido & Walter both Python and D support nested functions, so > in such situations I put t

Re: improved search algorithm

2009-05-04 Thread MRAB
grahamdic...@gmail.com wrote: Hi I have an excel file that is read into python (8000 rows) from csvimport reader, writer incsv = reader(open(MY_FILE), dialect='excel') keys = incsv.next() There are mixed datatypes. the last column contains a cumulative frequency running in order 0.000

change some lines from a read file

2009-05-04 Thread utab
Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this directly, I can count the line numbers and decide on this basis to decide the lines to

pychecker vs pychecker2

2009-05-04 Thread qhfgva
For my edification I was looking through the source code of pychecker. I noticed that there was also a pychecker2 directory (ubuntu). The pychecker command line tool points to pychecker (w/out the 2). Does anyone know off the top of their head what this second directory is about? thanks qhfgva

Re: Self function

2009-05-04 Thread bearophileHUGS
Steve Howell: >two methods with almost identical names, where one function is the public >interface and then another method that does most of the recursion.< Thanks Guido & Walter both Python and D support nested functions, so in such situations I put the recursive function inside the "public int

improved search algorithm

2009-05-04 Thread grahamdick77
Hi I have an excel file that is read into python (8000 rows) from csvimport reader, writer incsv = reader(open(MY_FILE), dialect='excel') keys = incsv.next() There are mixed datatypes. the last column contains a cumulative frequency running in order 0. to 1. for the 8000 rows f

Re: find sublist inside list

2009-05-04 Thread mzdude
On May 4, 9:01 am, Matthias Gallé wrote: > bearophileh...@lycos.com wrote: > > John O'Hagan: > >> li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] > >> for i  in range(len(li)): > >>     if li[i:i + 2] == ['a', 'c']: > >>         li[i:i + 2] = ['6'] > > > Oh well, I have done a mistake, it seems. > > A

Personal recommendations for Python and Django on-boarding materials

2009-05-04 Thread Grant Rettke
Hi folks, >From one developer to another, I am looking for some personal recommendations on what are the best materials for fast tracking an on- boarding to Python and Django. I know how to program, get web apps and OO; this is the audience. I have found some good recommendations and stuff on Am

Open a dialog from MainWindow - pyQT4 - Beginner :-)

2009-05-04 Thread Florian Wollenschein
Dear folks, I'm just working on a pyQT4 version of my txt to html converter thc (see listick.org for details). I created the MainWindow with QT Designer and then converted it to .py with pyuic4. It works well so far. Then I created a new UI for my abtDialog (about dialog for my application).

Re: Is it better to use threads or fork in the following case

2009-05-04 Thread CTO
> Which brings us backs to the "20 questions"-part of my earlier post. It > could be, but it could also be that processing takes seconds. Or it takes > so long that even concurrency won't help. Who knows? Probably the OP ;) Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list

Re: find sublist inside list

2009-05-04 Thread John O'Hagan
On Mon, 4 May 2009, Francesco Guerrieri wrote: > On Mon, May 4, 2009 at 3:01 PM, John O'Hagan wrote: > > On Mon, 4 May 2009, Matthias Gallé wrote: > > > Hi. > > > > > > My problem is to replace all occurrences of a sublist with a new > > > element. > > > > > > Example: > > > Given ['a','c','a','c'

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Detlev Offenbach
Mike Driscoll wrote: > On May 4, 10:13 am, Soumen banerjee wrote: >> Hello, >> I have just installed and run python 2.6.2 from the sources available >> on the website. I notice that SPE (the editor which i used with python >> 2.5) is not displaying some of the functions new in 2.6 as >> autocompl

Re: replacing numbers in LARGE MATRIX with criterium in 2 columns (a--> b)

2009-05-04 Thread Aahz
In article <68d22002-fc0a-4590-9395-c78b6ee41...@r34g2000vba.googlegroups.com>, Alexzive wrote: > >I have this matrix [20*4 - but it could be n*4 , with n~100,000] in >file "EL_list" like this: Take a look at NumPy -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/

Re: [ANN] regobj - Pythonic object-based access to the Windows Registry

2009-05-04 Thread Glenn Linderman
On approximately 5/3/2009 7:35 AM, came the following characters from the keyboard of Ryan Kelly: Hi All, I've just released the results of a nice Sunday's coding, inspired by one too many turns at futzing around with the _winreg module. The "regobj" module brings a convenient and clean objec

How is the start of my server monitoring code?

2009-05-04 Thread Echo
I just started a project to monitor servers(load, memory, processes, etc) via ssh(using paramiko). And I was hoping to get some input on the design of my project, how pythonic it is, etc. It is quite basic right now. But it is currently able to get load and memory stats from any number of servers.

Re: find sublist inside list

2009-05-04 Thread Aahz
In article , =?ISO-8859-1?Q?Matthias_Gall=E9?= wrote: > >My problem is to replace all occurrences of a sublist with a new element. > >Example: >Given ['a','c','a','c','c','g','a','c'] I want to replace all >occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). What's your goal? After you do

Re: Code works fine except...

2009-05-04 Thread Aahz
In article <8d4ec1df-dddb-469a-99a1-695152db7...@n4g2000vba.googlegroups.com>, Ross wrote: > >def test_round_robin(players, rounds, courts, doubles = False): >players = range(players) >for week in round_robin(players,rounds,courts): > if doubles == True: > doub

Re: Your confirmation is required to join the Python-list mailing list

2009-05-04 Thread Allan Yuan
Hi, I just wanna know how to set SYSTEM variables and USER variables of windows, but got no way. Firstly I thought "os.environ + os.system" may work well, but found no way to let "os.environ" run to retrive USER variables. Then I tried win32api, finding the GetEnvironmentVariables() mixing SYSTEM

Re: How to walk up parent directories?

2009-05-04 Thread Matthew Wilson
On Sun 03 May 2009 09:24:59 PM EDT, Ben Finney wrote: > Not every simple function belongs in the standard library :-) Thanks for the help with this! Maybe I'm overestimating how often people need this walkup function. Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 8:29 pm, John Machin wrote: > On May 4, 12:36 pm, Ross wrote: > > > > > For the past couple weeks, I've been working on an algorithm to > > schedule tennis leagues given court constraints and league > > considerations (i.e. whether it's a singles or a doubles league). Here > > were my r

Re: fcntl and siginfo_t in python

2009-05-04 Thread ma
Ok! So, I decided to write a C-extension instead of using ctypes. So far, I create a module called dnotifier and the handler callback receives two arguments, the signal number and the respective file descriptor that was modified. This works beautifully. Now, I want to release this to the public, s

Re: IDE for python 2.6 (auto complete)

2009-05-04 Thread Mike Driscoll
On May 4, 10:13 am, Soumen banerjee wrote: > Hello, > I have just installed and run python 2.6.2 from the sources available > on the website. I notice that SPE (the editor which i used with python > 2.5) is not displaying some of the functions new in 2.6 as > autocomplete options. Is there any IDE

Re: Self function

2009-05-04 Thread Steve Howell
On May 3, 3:39 pm, bearophileh...@lycos.com wrote: > Sometimes I rename recursive functions, or I duplicate&modify them, > and they stop working because inside them there's one or more copy of > their old name. > This happens to me more than one time every year. > So I have written this: > > from i

Re: Default padding for Tkinter grid

2009-05-04 Thread Amr
On May 4, 3:57 pm, "Gabriel Genellina" wrote: > En Mon, 04 May 2009 10:27:49 -0300, Amr escribió: > > > I've been spending the last few days experimenting with Tkinter. The > > grid manager is nice and easy to use, but I have found that I am often > > having to specify padx and pady options to ev

IDE for python 2.6 (auto complete)

2009-05-04 Thread Soumen banerjee
Hello, I have just installed and run python 2.6.2 from the sources available on the website. I notice that SPE (the editor which i used with python 2.5) is not displaying some of the functions new in 2.6 as autocomplete options. Is there any IDE with support for autocomplete in python 2.6 with all

Re: find sublist inside list

2009-05-04 Thread MRAB
Matthias Gallé wrote: bearophileh...@lycos.com wrote: John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i in range(len(li)): if li[i:i + 2] == ['a', 'c']: li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems. Another solution then: 'acaccgac'.replace("ac", c

Re: Default padding for Tkinter grid

2009-05-04 Thread Gabriel Genellina
En Mon, 04 May 2009 10:27:49 -0300, Amr escribió: I've been spending the last few days experimenting with Tkinter. The grid manager is nice and easy to use, but I have found that I am often having to specify padx and pady options to every widget I add to my grid. The way I am doing it is to cre

Re: find sublist inside list

2009-05-04 Thread bearophileHUGS
Matthias Gallé: >the int that can replace a sublist can be > 255,< You didn't specify your integer ranges. Probably there are many other solutions for your problem, but you have to give more information. Like the typical array size, typical range of the numbers, how much important is total memory

Re: find sublist inside list

2009-05-04 Thread Matthias Gallé
bearophileh...@lycos.com wrote: John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i in range(len(li)): if li[i:i + 2] == ['a', 'c']: li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems. Another solution then: 'acaccgac'.replace("ac", chr(6)) '\x06\x06cg\x06

Re: if statement, with function inside it: if (t = Test()) == True:

2009-05-04 Thread Antoon Pardon
On 2009-04-24, Steven D'Aprano wrote: > On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote: > >> Hello, >> >> I'm trying to do a if statement with a function inside it. I want to use >> that variable inside that if loop , without defining it. >> >> def Test(): >> return 'Vla' >> >> I sear

Re: Code works fine except...

2009-05-04 Thread Ross
On May 3, 10:16 pm, John Yeung wrote: > On May 3, 11:29 pm, Chris Rebert wrote: > > > Probably not the cause of the problem, but where > > did the magic numbers 1.072 and 1.08 come from? > > It is perhaps not the most direct cause of the problem, in the sense > that the magic numbers could take v

Re: AutoComplete in C++ Editor for Python

2009-05-04 Thread flamz3d
On May 3, 3:14 pm, Dave Angel wrote: > flam...@gmail.com wrote: > > Hello, > > I am embedding python support in my C++ application and was looking at > > adding "Intellisense" or "AutoComplete" support. > > > I found a way to do it using the "dir" function, but this creates a > > problem. Here's w

Re: Code works fine except...

2009-05-04 Thread Ross
On May 4, 7:01 am, Ross wrote: > On May 3, 10:16 pm, John Yeung wrote: > > > > > On May 3, 11:29 pm, Chris Rebert wrote: > > > > Probably not the cause of the problem, but where > > > did the magic numbers 1.072 and 1.08 come from? > > > It is perhaps not the most direct cause of the problem, in

Re: How to walk up parent directories?

2009-05-04 Thread David Smith
Matthew Wilson wrote: > Is there already a tool in the standard library to let me walk up from a > subdirectory to the top of my file system? > > In other words, I'm looking for something like: > > >>> for x in walkup('/home/matt/projects'): > ... print(x) > /home/matt/projects >

  1   2   >