Most SHAMEFUL one-liner:

J

Jeremy Moles

I was looking through some code of my today and noticed this little gem
I wrote a few days back that I had totally forgot about:

fill = [("%%-%ds\n" % (columns - 1)) % " " for i in range(yoffset - 2)]

....and then I went on to do:

"".join(fill)

Talk about using the wrong tool for the job... :(

All I needed was:

" " * (columns - 1) * (yoffset - 2)

Anyone else remember any shameful one-liners like this? :) I'm just
curious to see what kinda mistakes people make you think about a
solution WAY TO HARD... :)
 
B

Bengt Richter

I was looking through some code of my today and noticed this little gem
I wrote a few days back that I had totally forgot about:

fill = [("%%-%ds\n" % (columns - 1)) % " " for i in range(yoffset - 2)]

...and then I went on to do:

"".join(fill)

Talk about using the wrong tool for the job... :(

All I needed was:

" " * (columns - 1) * (yoffset - 2)
So the original was wrong as well as a bit opaque? (What happened to the \n ? ;-)

Regards,
Bengt Richter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top