Closed ajahraus closed 1 year ago
By adding return self at the end of mutating operations, such as bytealign(), we have the option of writing
return self
bytealign()
def some_function(args): return BitStream(f"uint8={args}").bytealign() # or whatever
But, because bytealign() returns nothing, we have to save to an intermediate variable
def some_function(args): stream = BitStream(f"uint8={args}") # or whatever stream.bytealign() return stream
My bad, I misinterpreted what the bytealign() method did, it only affects the pos field in a BitSteam or ConstBitStream when reading, it has nothing to do with creation.
pos
By adding
return self
at the end of mutating operations, such asbytealign()
, we have the option of writingBut, because
bytealign()
returns nothing, we have to save to an intermediate variable