-
Notifications
You must be signed in to change notification settings - Fork 15
Home
Microsoft created Linq (Language Integrated Query) using Expression trees, which is a math concept on how to parse operations into trees in a way that you can analyze the operations independently from the result.
Pynq is an implementation in Python of the Expression Tree theory and some of the providers. There will be more providers gradually, but Pynq will strive to make it as easy as possible to write your own provider.
Since Pynq uses solely expression trees as means to the provider to parse whatever it needs to parse, it means that anyone can implement a provider to basically anything that can be queried.
Expression Trees are a pretty simple concept to grasp (even though they are complex to implement). Let’s see an example:
Let’s say we want an expression tree of the “2+3” expression. This is what it evaluates to:
BinaryExpression("Add", ConstantExpression(2), ConstantExpression(3))
What that means is that a provider can now parse the expression you informed in order to find that you wanted the sum of 2 and 3, whatever that means in the given context.
If you want to know more about how Pynq implements expression trees and the ones available to you, check the Expression Trees page.
Pynq comes with a factory called From (from is a keyword in Python, thus we chose to ignore PEP-81)