Re: Most SHAMEFUL one-liner:

2005-12-06 Thread Jon Perez
Jeremy Moles wrote:
 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... :)

So TIMTOWTDI after all in Python!!



-- 
http://mail.python.org/mailman/listinfo/python-list


Most SHAMEFUL one-liner:

2005-12-04 Thread 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... :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Most SHAMEFUL one-liner:

2005-12-04 Thread Bengt Richter
On Fri, 02 Dec 2005 14:25:41 -0500, Jeremy Moles [EMAIL PROTECTED] wrote:

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
-- 
http://mail.python.org/mailman/listinfo/python-list