you shouldn’t copy and paste code anyway.
How to display code blocks in Medium
Quincy Larson
1.2K36

You can’t… be serious. ;-)

Don’t get me wrong — I’m Mr. Code Reuse; I’m Mr. Don’t Reinvent The Wheel. I write good code and I Don’t Repeat Myself. I also cut and paste code each and every day!

And the reasoning is simple — many segments of code are simply too small to re-use any other way. For example, yesterday I looked up this code sample (to chunk a list into sublists in Python — I couldn’t quite remember the trick, and more, it was the end of the day and I was lazy):

zip(*[iter(l)] * chunks)

Should I find some project that has this function exposed, and bring it into my code? Or should I copy and paste?

(When I have something obscure, I also always add a link to where I got it from. I didn’t do that here — I felt it was pretty obvious once you see it.)

Overall, I loved this article, and having live code embedded into Medium is amazing! I only wish it had languages other than Javascript. Hint hint hint….