Geeks With Blogs

News

Currently Reading

CLR via C#m

Under The Influence(of code) Abhijeet Patel's blog Python
Chunking a List - .NET vs Python
Chunking a List As I mentioned last time, I'm knee deep in python these days. I come from a statically typed background so it's definitely a mental adjustment. List comprehensions is BIG in Python and having worked with a few of them I can see why. Let's say we need to chunk a list into sublists of a specified size. Here is how we'd do it in C# static class Extensions { public static IEnumerable<List<T>... Chunk<T>(this List<T> l, int chunkSize) { if (chunkSize <0) { throw ......

Posted On Sunday, March 7, 2010 12:36 PM

Copyright © Abhijeet Patel | Powered by: GeeksWithBlogs.net