Re: Compress a string

2008-05-18 Thread Matt Porter
On Sun, 18 May 2008 20:30:57 +0100, Peter Otten <[EMAIL PROTECTED]> wrote: Matt Porter wrote: I'm trying to compress a string. E.g: "BBBC" -> "ABC" Two more: from itertools import groupby "".join(k for k, g in groupby("aa

Re: [EMAIL PROTECTED]: Re: Compress a string]

2008-05-18 Thread Matt Porter
On Sun, 18 May 2008 19:13:57 +0100, J. Clifford Dyer <[EMAIL PROTECTED]> wrote: On Sun, May 18, 2008 at 07:06:10PM +0100, Matt Porter wrote regarding Compress a string: Hi guys, I'm trying to compress a string. E.g: "BBBC" -> "ABC" The code I have

Compress a string

2008-05-18 Thread Matt Porter
Hi guys, I'm trying to compress a string. E.g: "BBBC" -> "ABC" The code I have so far feels like it could be made clearer and more succinct, but a solution is currently escaping me. def compress_str(str): new_str = "" for i, c in enumerate(str): try: if c !=

Re: License selection for free software

2008-05-06 Thread Matt Porter
On Tue, 06 May 2008 20:02:21 +0100, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: [EMAIL PROTECTED] (Ville M. Vainio) writes: [EMAIL PROTECTED] (Ville M. Vainio) writes: I don't think BSD/MIT like license really annoys anyone. Think python here ;-) Python's non-GPL license certainly is a