Typo:

when condition is non-empty

should be

when conditionS is non-empty


On Wed, Jan 8, 2014 at 1:53 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> a new section has been added as the first “Core Behavioral Change”:
>
> http://sqlalchemy.readthedocs.org/en/rel_0_9/changelog/migration_09.html#none-can-no-longer-be-used-as-a-partial-and-constructor
>
>
>
> On Jan 8, 2014, at 11:27 AM, Michael Bayer <mike...@zzzcomputing.com> wrote:
>
>
> geez..its 10 degrees here, sorry, just scratch that first case, it has to be
> like this to be fully compatible both ways:
>
> def my_select(conditions):
>     stmt = select([column('x')])
>     if conditions:
>         stmt = stmt.where(and_(*conditions))
>     return stmt
>
> “cond & None” was never any kind of publicly documented behavior and it was
> inconsistent, sorry.
>
>
>
>
>
>
>
>
> On Jan 8, 2014, at 11:22 AM, Michael Bayer <mike...@zzzcomputing.com> wrote:
>
> 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 <mike...@zzzcomputing.com> 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)
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to