Skip to content

make_class does NOT keep the order of the attrs args when creating a class #339

@pombredanne

Description

@pombredanne

If I use make_class and I pass an OrderedDict of name/attribs, the created class does not have these created in the original order.

Somehow make_class ends up using some plain dicts for attrs (whether this is originally a list or an Ordered mapping) and my attributes order is lost... which means that down the road my serialization order is also lost and that eventually the order of the arguments is not entirely clear.
As it is this creates classes with a pseudo-random attributes order (as it depends on the Python hash function used in the dict)

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