Re: Please Criticize My Code

2005-08-21 Thread Ray
Christoph Rackwitz wrote: > Why not? Because the regex isn't compiled? > Don't tell me not to do something, tell me why i should'nt do it. No it's not the regex, it's because you just spoiled the challenge for everybody who hasn't solved level 10 yet... -- http://mail.python.org/mailman/listinfo

Re: Please Criticize My Code

2005-08-21 Thread Christoph Rackwitz
Why not? Because the regex isn't compiled? Don't tell me not to do something, tell me why i should'nt do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Please Criticize My Code

2005-08-20 Thread Jeff Schwab
Christoph Rackwitz wrote: > i guess, it is pythonchallenge.com level 10? > if so, i used this thing: > > import re > def enc(s): > return ''.join('%s%s' % (len(a[0]),a[0][0]) for a in > re.findall('((.)\\2*)', s)) > Don't do that! -- http://mail.python.org/mailman/listinfo/python-list

Re: Please Criticize My Code

2005-08-20 Thread Christoph Rackwitz
i guess, it is pythonchallenge.com level 10? if so, i used this thing: import re def enc(s): return ''.join('%s%s' % (len(a[0]),a[0][0]) for a in re.findall('((.)\\2*)', s)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Please Criticize My Code

2005-08-20 Thread Michael Hoffman
Ray wrote: > Well... I'm always paranoid that I'm, you know, writing Java in Python > :) The biggest mistakes I see are wrapping everything in a class unnecessarily, or using accessor methods instead of properties (ugh, ugh, ugh!). CamelCasingYourVariableNames is annoyingToMe but that's really

Re: Please Criticize My Code

2005-08-20 Thread Ray
Michael Hoffman wrote: > Ray wrote: > > > I just wrote a short script that generates look and say sequence. What > > do you Python guys think of it? Too "Java-ish"? > > Yes, but that's beside the point. :) Well... I'm always paranoid that I'm, you know, writing Java in Python :) Thanks for the

Re: Please Criticize My Code

2005-08-20 Thread Ray
Damn, those are cool, man. Thanks! This Python thing keeps expanding and expanding my brain... Ray [EMAIL PROTECTED] wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: Please Criticize My Code

2005-08-20 Thread bearophileHUGS
Two versions of mine, one of the fastest (not using Psyco) and one of the shortest: . from itertools import groupby . . def audioactiveFast(n): . strl = {("1","1","1"): "31", ("1","1"): "21", ("1",): "11", . ("2","2","2"): "32", ("2","2"): "22", ("2",): "12", . ("3","3"

Re: Please Criticize My Code

2005-08-20 Thread Michael Hoffman
Ray wrote: > I just wrote a short script that generates look and say sequence. What > do you Python guys think of it? Too "Java-ish"? Yes, but that's beside the point. :) I think your basic design was sound enough for this application (presumably this isn't something that needs to run at high s

Please Criticize My Code

2005-08-20 Thread Ray
Hello, I just wrote a short script that generates look and say sequence. What do you Python guys think of it? Too "Java-ish"? I can't shake off the feeling that somebody may have done this with 2-3 lines of Python magic. Heh. # generator for sequence def lookAndSaySequence(firstTerm, n): term