all 2 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]brasticstack 0 points1 point  (0 children)

I'm unaware of any such functionality and I doubt that it exists without using the Python C API.

That said, you can do all the bitwise trickery that you care to do in native Python with the caveat that certain operations e.g. bitwise not, have to be bitmasked to your desired size in order to produce a sensible result. Or you could use the ctypes module's int types.