Linq to Python

Thomas G. Willis tom.willis at gmail.com
Wed Sep 24 18:47:18 EDT 2008


On Sep 24, 4:59 pm, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
...
> I haven't yet had occasion to use LINQ in anger yet, so I have no idea
> whether its an idea to love or to hate. I do think it is good that C# has
> effectively sprouted list comprehensions (not to mention anonymous types
> and type inferencing) and I expect there may be some aspects worth looking
> at for Python but I think they are more likely to lead to itertools
> functions than extensions to syntax.

My thoughts exactly when I first looked at it. "Hey C# NOW has list
comprehensions!!! SWEET!!!"

As I understand it LINQ is libraries(System.Data.Linq.dll,
System.XML.Linq.dll) + syntactic sugar, i wouldn't call that a change
to the language. The addition of lambdas and functions as first class
objects however, that was indeed a language change, and it was a
change for the better that makes LINQ possible, (also makes writing
delegates less cumbersome). To someone other than a C# person, these
features are not new or revolutionary, it's just C# catching up. Kudos
to them for getting there before java.

After some more thought on what might conceivably be missing from
python that LINQ has, that someone might want is the equivalent of
System.XML.Linq.dll, and I can't see any reason why someone couldn't
write it with the exception that there doesn't seem to be a definitive
XML lib for python, meaning generally regarded as the best. That in my
mind would be a prerequisite. But if someone wrote both the XML lib
with the LINQ-ish syntax, maybe it would become the definitive XML
lib.

Again, I personally don't see myself using XML and thus needing that
unless my hand was forced by some business requirement that dictated I
use XML, I would not use it if I had a choice. The SQL LiNQ-ish
though, I think every python ORM has that covered to a degree, and I
use that quite a bit.






More information about the Python-list mailing list