Christian Tismer wrote: > Simon Hengel wrote: > >>-----BEGIN PGP SIGNED MESSAGE----- >>Hash: SHA1 >> >> >>>I'm envisioning lots of convoluted one-liners which >>>are more suitable to a different P-language... :-) >> >>I feel that python is more beautiful and readable, even if you write >>short programs. >> >> >>>How about """best compromize between shortness and readibility >>>plus elegance of design"""? >> >>I would love to choose those criteria for future events. But I'm not >>aware of any algorithm that is capable of creating a ranking upon them. >>Maybe we can come up with a solution. Any ideas? > > > Me neither :-) > > Maybe a compromize proposal could be like this: > > - Squeezing many lines into one using semicola does not help, > the program will be expanded to use one statement per line > > - blank lines are allowed and not counted if they are not > needed as part of the code
These two would be easy to acomplish using something like: def countchars(text): n = 0 for line in text.split('\n'): n += len(line.strip()) return n This would ignore leading and trailing white space as well as blank lines. Also makes a=5; b=10 measure as one character longer than a = 5 b = 10 which can only be good. > > - the length of names does not count, unless the code depends on it. Probably too hard. > > Some harmonization procedure might be applied to every solution > before counting lines, in order to avoid spectacular cryptic stuff. I thought the metric was characters, not lines. At least that's what the 'about' page says. You still get hit by leading whitespace on multiple line programs though. -tim > > I have no idea whether I'm serious about this. > Having this said, I'm trashing my one-liner :-)) > > if-it-doesn't-look-like-Python-it-is-not-Python - ly y'rs -- chris -- http://mail.python.org/mailman/listinfo/python-list