Closed scott-griffiths closed 5 months ago
Yeah, this is a pain. Maybe there should have been an intermediate class:
class Options:
__slots__ = ('bytealigned', 'lsb0')
def __init__(self):
self.bytealigned = False
self.lsb0 = False
def __repr__(self):
return f"bytealigned: {self.bytealigned}\n lsb0: {self.lsb0}"
options = Options()
This could be added with some extra plumbing to link it to the current options, and use this method in the documentation?
The bitstring.options object is now the preferred method - I'm not sure it was possible to fix the underlying problem with the other methods.
If you import using
from bitstring import *
then you get both
lsb0
andbytealigned
imported, but changing them doesn't have any effect.It also doesn't work if you do
from bitstring import lsb0
for example.
They do work the more usual way:
Probably should remove them from the
__all__
definition at least. Not sure if the underlying problem is fixable as the whole module property thing is a bit hacky.