Skip to content

You can set an Int with a bool value #12

@das-intensity

Description

@das-intensity

The readme says in the TODO list that x = Int(5); x.set('bad') should error. It does, this has already been fixed.

However you can still set an Int to be a bool, e.g. x = Int(5); x.set(True). This is because isinstance(True, int) == True`. Historical reasons why are given in this SO post.

This should be solved one of two ways:

  1. Prevent setting an Int with a bool value
  2. Convert the bool to int on set

I think either is fine, as long as the reasoning for the choice is detailed in the readme

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions