Is your feature request related to a problem?
Column has no bitwise operation methods.
Analysis
Adding Column.and_(), Column.or_(), etc. is not needed — Column.map + the Cell API already makes Column-level bitwise methods redundant. Users can write column.map(lambda cell: cell.and_(other)) instead.
However, the current Cell API does not support integer bitwise operations:
- The existing
and_, or_, xor, not_ operators on Cell are Boolean-only (enforced via CellTypeRequirements.BOOLEAN). They reject integer cells with ColumnTypeError.
- There are no shift operations (
__lshift__/__rshift__, shift_left/shift_right) on Cell at all.
Desired solution
Add integer bitwise support to the Cell API as named methods and operators directly on Cell (no namespace). Column.map then naturally provides Column-level access — no Column-level methods needed.
Operators (&, |, ^, ~, <<, >>): Accept both Boolean and integer cells, following Python's own convention where & on bool is logical and & on int is bitwise. The existing CellTypeRequirements.BOOLEAN check is relaxed to also accept integer cells.
Named methods: Flat on Cell with a bitwise_ prefix for integer methods to distinguish them from the existing Boolean named methods. The prefix is applied consistently across all bitwise methods (including shifts) for discoverability and grouping in autocomplete.
| Operator |
Boolean named method |
Integer named method |
& |
and_() |
bitwise_and() |
| |
or_() |
bitwise_or() |
^ |
xor() |
bitwise_xor() |
~ |
not_() |
bitwise_invert() |
<< |
— |
bitwise_left_shift() |
>> |
— |
bitwise_right_shift() |
Example usage:
# Boolean (existing behavior, unchanged)
column.map(lambda cell: cell & other) # logical AND (operator)
column.map(lambda cell: cell.and_(other)) # logical AND (named)
# Integer (new)
column.map(lambda cell: cell & 0xFF) # bitwise AND (operator)
column.map(lambda cell: cell.bitwise_and(0xFF)) # bitwise AND (named)
column.map(lambda cell: cell << 2) # left shift (operator)
column.map(lambda cell: cell.bitwise_left_shift(2)) # left shift (named)
Is your feature request related to a problem?
Column has no bitwise operation methods.
Analysis
Adding
Column.and_(),Column.or_(), etc. is not needed —Column.map+ the Cell API already makes Column-level bitwise methods redundant. Users can writecolumn.map(lambda cell: cell.and_(other))instead.However, the current Cell API does not support integer bitwise operations:
and_,or_,xor,not_operators on Cell are Boolean-only (enforced viaCellTypeRequirements.BOOLEAN). They reject integer cells withColumnTypeError.__lshift__/__rshift__,shift_left/shift_right) on Cell at all.Desired solution
Add integer bitwise support to the Cell API as named methods and operators directly on
Cell(no namespace).Column.mapthen naturally provides Column-level access — no Column-level methods needed.Operators (
&,|,^,~,<<,>>): Accept both Boolean and integer cells, following Python's own convention where&onboolis logical and&onintis bitwise. The existingCellTypeRequirements.BOOLEANcheck is relaxed to also accept integer cells.Named methods: Flat on Cell with a
bitwise_prefix for integer methods to distinguish them from the existing Boolean named methods. The prefix is applied consistently across all bitwise methods (including shifts) for discoverability and grouping in autocomplete.&and_()bitwise_and()|or_()bitwise_or()^xor()bitwise_xor()~not_()bitwise_invert()<<bitwise_left_shift()>>bitwise_right_shift()Example usage: