From: Mike Bayer Date: Wed, 9 Dec 2009 00:01:35 +0000 (+0000) Subject: merge r6551 of trunk for [ticket:1354] X-Git-Tag: rel_0_5_7~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a8024fffce6493e4a784c1dfa2f63e12471bb681;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git merge r6551 of trunk for [ticket:1354] --- diff --git a/doc/build/sqlexpression.rst b/doc/build/sqlexpression.rst index b6acf23434..19598f29cb 100644 --- a/doc/build/sqlexpression.rst +++ b/doc/build/sqlexpression.rst @@ -426,6 +426,12 @@ If you have come across an operator which really isn't available, you can always >>> print users.c.name.op('tiddlywinks')('foo') users.name tiddlywinks :name_1 +This function can also be used to make bitwise operators explicit. For example:: + + somecolumn.op('&')(0xff) + +is a bitwise AND of the value in `somecolumn`. + Conjunctions ============= diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index cf08ec1951..a1ebb179fc 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1506,11 +1506,17 @@ class _CompareMixin(ColumnOperators): somecolumn * 5 - operator - a string which will be output as the infix operator between + + :param operator: a string which will be output as the infix operator between this ``ClauseElement`` and the expression passed to the generated function. + This function can also be used to make bitwise operators explicit. For example:: + + somecolumn.op('&')(0xff) + + is a bitwise AND of the value in somecolumn. + """ return lambda other: self.__operate(operator, other)