ok, so this is a bit complex, I'm writing a bit-field function using a template, which can consist of:
field( Template, Value )
field( [1,7,15] ,255 ) #int representation...
field( ['1','3','4'] ,255 ) #bit representation...
#>>> [1,7,15]
field( [1,7,15] ,[1,7,15] )
field( ['1','3','4'] ,[1,7,15] )
#>>> 255
so what I'm looking for is a way to R-shift Value
by the binary size of the data field during enumeration in a generator...
here's the unfinished int >>> list method for example:
return [(Value>> ? )&(~(~0<<int(t)) if t.__class__==str else t) for t in Template]
what would I have to do to the ?
to get what I'm after??
thanks :)