[Sqlalchemy-tickets] Issue #3816: consider rollup of __clause_element__() onto ClauseElement (zzzee
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2016-10-05 16:25:42
|
New issue 3816: consider rollup of __clause_element__() onto ClauseElement https://bitbucket.org/zzzeek/sqlalchemy/issues/3816/consider-rollup-of-__clause_element__-onto Michael Bayer: tried to do this for #3802 late in 1.1 but it's too critical if someone is doing a while loop, and here's at least one example: https://github.com/albertov/py-mailing/blob/a81d71f35b3c04de75cca48eb82b0b85bbaaf915/mailing/models/util.py#L45. there's no reason that person would have done that besides copying our code. additionally, if we put `__clause_element__()` onto ClauseElement, there's a lot of internal checks that should also be optimized. other more far-out tricks would be: 1. return a copy of the object that raises some assertion on `__clause_element__()`. though this is expensive 2. deprecate `__clause_element__()` and replace with some totally other method. But we'd need almost-forever backwards compat for calling upon `__clause_element__` also in this case. It sort of suggests all the places where we do `hasattr(obj, '__clause_element__')` should become some other kind of single call that perhaps we can put into cutils. Detecting `__clause_element__` itself would then raise some kind of deprecation warning. |