Skip to content

When structuring, how to forbid type casting to base classes? #469

Open
@philip-bl

Description

@philip-bl

I want to use cattrs to structure dicts and other stuff to attrs. However, I am unhappy with the default behaviour that if attrs expects an int, float, str, bool or something like that, it casts the object to that type using int(), float(), str(), or bool() respectively. I want cattrs to structure containers such as sequences, dicts, etc. but I don't want it to typecast base types - I want it to error out instead if the types don't match. How can I do this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions