Speaker Deck

Implementing LINQ-for-objects in Python

by Robert Smallshire

Published October 11, 2012 in Programming

The Language Integrated Query (LINQ) feature of Microsoft's .NET Framework provides an DSL for expressing queries over arbitrary data sources. Using LINQ with one data source type in particular - simple in-memory collections - has proven particularly popular with .NET programmers, such that many .NET developers now eschew many imperative constructs in favour of the declarative, functional style afforded by LINQ-to-objects.

Python already has strong support for lazily transforming collections with its generator syntax, which although concise in simple cases can be unwieldy for more complex queries.

At this meetup, I'll present "asq", an implementation of LINQ-to-objects for Python which has been well received and met with some success. I'll introduce LINQ, explain the implementation if asq and demonstrate its use. I'll also outline some ideas for future directions for the library.