-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Dec 5, 2011, at 1:39 PM, Daniel Nouri wrote:
>
> Thanks for your explanation. I haven't used hybrid a lot yet and this
> helped me understand what it does and what not.
>
> Your last example that uses a 'with_transformation', i.e. a protocol
> that I guess would amount to allowing to run the query through an
> arbitrary function, is quite nice to read, and I'd definitely be a
> user. Then again, there's nice enough alternatives for what I'm
> trying to do, so I'll be fine without. :-)
OK, well with_transformation is literally:
def with_transformation(self, fn):
return fn(self)
so there's not much controversy there. I've added it and wrote up an example
of how to combine this with a hybrid comparator, to produce two approaches for
your problem (which just makes a nice example). It looks *interesting*, but I
don't know how much this pattern would catch on - if it's one of those patterns
that can keep expanding out or not. Check it out at:
http://www.sqlalchemy.org/docs/orm/extensions/hybrid.html#building-transformers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: GPGTools - http://gpgtools.org
iQEcBAEBAgAGBQJO3UX7AAoJEDMCOcHE2v7hRGMH/3nYQrjTtjl29esLE6y9pZEH
PPbNTve1+tHrWEOhLS8ZH8KmlAiwnUD+X7vGTPQraSyzyOGqJ42H9/s90fKrDJ6G
UnvGofsN5G1FCjLdrllkAmbolk1X1864RY6fQyhj0I3CfN4bphSM42LpSiYeE/8s
y1Ag2EfwzwYm2sQIDbfE2tyFiFyBb3ZjOkm6Jqo7n2L6zqNl5NdxbheVaOZw+hA1
OdRiro4ISRXx0RCL1D5rmNnl9OBo91DNE3LefOk+49Hl95FJU4uklXXv14cMbRHX
hjhgS9WO0Ji6ffB/PfcUNjsq6xH/ZWuSfnAqApu6w/p6YzlMTt9RIDrvW24D200=
=+X5S
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.