sorry, this should read: "Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it as follows, in which case it works the same in both versions:"
def my_select(conditions):
cond = None
for c in conditions:
cond = c & cond
stmt = select([column(‘x’)])
if cond is not None:
stmt = stmt.where(cond)
return stmt
On Jan 8, 2014, at 11:20 AM, Michael Bayer <[email protected]> wrote:
> Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it as
> follows, in which case it works the same in both versions:
>
> def my_select(conditions):
> cond = conditions[0]
> for c in conditions[1:]:
> cond = c & cond
> stmt = select([column(‘x’)])
> if cond is not None:
> stmt = stmt.where(cond)
> return stmt
>
> or you assume that “conditions” is non-empty, in which case, as I mentioned
> earlier, do this:
>
> def my_select(conditions):
> cond = conditions[0]
> for c in conditions[1:]:
> cond = c & cond
>
> return select([column('x')]).where(cond)
signature.asc
Description: Message signed with OpenPGP using GPGMail
