Re: python challenge question (string manipulation)

2006-03-29 Thread Caleb Hattingh
John In python, strings are immutable - you have to create a new string no matter what you do. Also, I suspect you meant to say: >>> alphabet = string.ascii_lowercase >>> code = alphabet[2:] + alphabet[:2] I had a similar need recently for a guitar chord generator program I've been working on.

Re: python challenge question (string manipulation)

2006-03-29 Thread Caleb Hattingh
Terry That is very succint. Rewriting my shift function given earlier: >>> import string >>> alpha = string.ascii_lowercase >>> print alpha abcdefghijklmnopqrstuvwxyz >>> def shift(lst, n): return [lst[(i+len(lst)-n)%len(lst)] for i,item in enumerate(lst)] >>> print shift(alpha,2) ['y',

Re: Simple py script to calc folder sizes

2006-03-29 Thread Caleb Hattingh
Hi John Your code works on some folders but not others. For example, it works on my /usr/lib/python2.4 (the example you gave), but on other folders it terminates early with StopIteration exception on the os.walk().next() step. I haven't really looked at this closely enough yet, but it looks as

Re: python challenge question (string manipulation)

2006-03-30 Thread Caleb Hattingh
Felipe I get the same results as you. You make a good point about not iterating when it's not needed. I played around with your test code and found some interesting things: 1. enumerate vs. range(len()) has very little overhead (something I have wondered about) In my code, making the change c

Matplotlib: How to set number of ticks on an axis?

2006-03-30 Thread Caleb Hattingh
Hi I tried several Google searches to no avail. I read through pretty much most of the online docs at the matplotlib sourceforge site, but didn't find what I was looking for. I went through the axis.py and ticker.py code today, trying to find out how to set the number of points (ticks) on an axi

Re: Convert Word .doc to Acrobat .pdf files

2006-03-30 Thread Caleb Hattingh
If you can find some API documentation for PDFMWord.dll, you can call its methods with the ctypes python module. Caleb -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple py script to calc folder sizes

2006-03-30 Thread Caleb Hattingh
Ben, Thank you. Caleb -- http://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib: How to set number of ticks on an axis?

2006-03-30 Thread Caleb Hattingh
John, Thank you. Caleb -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 licensing: stop this change

2006-04-01 Thread Caleb Hattingh
Steve I agree with you. If my vote means anything, I vote against it. >> The Board realises that this change will be >> contentious. There are many advantages >> to making it, however, which we feel will >> benefit the Python community at large >> and the PSF membership in particular. >> Users w

Re: Python 2.5 licensing: stop this change

2006-04-01 Thread Caleb Hattingh
WAIT- Did I just get caught by an April Fools Joke? I have a nasty feeling about this :)) C -- http://mail.python.org/mailman/listinfo/python-list

<    1   2