[ python-Feature Requests-1618676 ] Promote list comprehensions to Language Integrated Query?

SourceForge.net noreply at sourceforge.net
Tue Dec 19 11:10:31 CET 2006


Feature Requests item #1618676, was opened at 2006-12-19 12:08
Message generated for change (Settings changed) made by jettlogic
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1618676&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: JettLogic (jettlogic)
Assigned to: Nobody/Anonymous (nobody)
>Summary: Promote list comprehensions to Language Integrated Query?

Initial Comment:
Hi,

A feature idea (shall put to mailing list discussion sometime), is to extend list comprehensions to many uses of SQL or XQuery unnecessary.  

The benefit of language integration over passing SQL/XQuery strings to external libraries would be making code agnostic to the source of the data: in-memory tables and trees could be queried just like a relational DB or XML.  An "order by" could be more efficient than sorted(f(x) for x in y).

Of course list comprehensions do much of the C#-style LINQ already, but they can't (easily) do joins or "select x from a, y from b" type queries, or return XML a la XQuery.    

On the library side, DBAPI helps make code independent of any particular database, and sqlite in 2.5 means in-memory tables (lists of tuples) aren't really necessary.

If worthwhile, implementation would probably be best suited to PyPy.

C# Example from http://en.wikipedia.org/wiki/Language_Integrated_Query

var q = from o in db.Orders, c in db.Customers
    where o.Quality == "200" && (o.CustomerID == c.CustomerID)
    select new { o.DueDate, c.CompanyName, c.ItemID, c.ItemName };

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1618676&group_id=5470


More information about the Python-bugs-list mailing list