How to generate k+1 length strings from a list of k length strings?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Jun 8 17:00:59 EDT 2006


Boris Borcic:

> I challenge you to write simpler code to do the equivalent.

I don't do challenges. I too have written the code to solve that
problem, it wasn't much different from your one (it uses a generator
function xpairs, to yeild a scan of the different pairs, about half the
square, it uses symmetric_difference, etc), but it's on different
lines, with variables (object names), etc. And maybe comments too.
It's not that difficult to improve the readability of a quite long
line, you can start splitting it.


> Sure, but the case is we each were *distinct* children.

Every person is different, so every person defines the style he/she
likes and understands  more.
But there can be defined some "coding suggestions", useful for most
people, to avoid the most common errors, and one of such errors is to
write very long lines, full of a lot of stuff, like your one.

Bye,
bearophile




More information about the Python-list mailing list