On May 31, 8:35 am, Gaetan de Menten <[email protected]> wrote: > Looks great to me... except for the metaclass trick which is quite > ugly. Is there really no other way?
Hmmm ... Google seems to have swallowed my response, or perhaps I accidentally clicked "Reply to author" instead of "Reply". Trying again ... Unfortunately, the metaclass hack is needed because of syntax incompatibilities in this area between 2.x and 3.x - 2.x raises a SyntaxError when the metaclass= keyword argument is seen in a class definition, so you can't rely on conditional execution and have to resort to an exec hack. I "borrowed" ;-) the technique from Benjamin Peterson's very useful "six" library of helpers for 2.x-3.x portability: http://pybites.blogspot.com/2010/06/six-python-23-compatibility-helpers.html I agree the compatibility syntax is not very pretty, but it's not hideous either. Hopefully most users won't need to peek under the Entity abstraction (most of the time, anyway). Regards, Vinay Sajip -- You received this message because you are subscribed to the Google Groups "SQLElixir" 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/sqlelixir?hl=en.
