Skip to content

Python API __repr__ printers for more objects #1654

@disconnect3d

Description

@disconnect3d

It would be nice to have __repr__ in more (or all) Python classes, e.g., operand displays could have more useful repr than just:

<capstone.x86.X86Op object at 0x7fe856a06640>

We did sth similar recently for the CsInsn in #1625

A lot of classes inherit from ctypes.Structure like in https://github.com/aquynh/capstone/blob/1b5014515d0d671048e2b43ce483d38d85a2bc83/bindings/python/capstone/x86.py so this could probably be implemented somehow generally by adding a base class that would inherit from ctypes.Structure and would use, .e.g., a _format field if its defined in the inherited class to go over fields we want to show and display them with given format?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions