I read Storm ORM's tutorial at https://storm.canonical.com/Tutorial, and I stumbled upon the following piece of code :
store.find(Person, Person.name == u"Mary Margaret").set(name=u"Mary Maggie")
I'm not sure that the second argument of the find method will be evaluated to True/False. I think it will be interpreted as a lambda. If that is true, how can I achieve the same effect in my functions ?
Person.name
has a overloaded __eq__
method that returns not a boolean value but an object that stores both sides of the expression; that object can be examined by the find()
method to obtain the attribute and value that it will use for filtering. I would describe this as a type of lazy evaluation pattern.
In Storm, it is implemented with the Comparable
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With