Clever One Liners

Michael Chermside mcherm at
Thu Jul 3 01:06:58 CEST 2003

Hannu Kankaanpää writes:
> Could be even written as a perverted one-liner.

I'm not picking on you in particular, there have been several people
doing this lately, but I'd like to ask folks to please lay off the
quest for one-liners.

I understand the neat, oh-so-clever feeling one gets by trying to
cram the most functionality into the least space, but if you're going
to try that, do it in Perl (or better yet, APL) where it works so
much better. I'm not putting down the exercise... I realize that it's
all in good fun... but people who are new to Python and who read this
newsgroup might get the wrong idea if they see a clever one-liner
proposed as the solution for every easy question. It's simply NOT 
Pythonic to try to write clever one-liners, and we don't want to let
newbies think it's appropriate.

> ...Maybe a real 'for' loop for getting the words would be better
> in this case though. So that the input could be verified too.

See, I can bring this up in response to Hannu's posting without 
pointing fingers since he clearly understands (and points out) the
advantages of a less compact style.

Donning-my-asbestos-suit-now lly,

-- Michael Chermside

More information about the Python-list mailing list