Skip to content

Math with builtin types not as expected #94

@avylove

Description

@avylove

While I can see reasons for it, it's counterintuitive that adding 1 to a Byte would make it a float rather than a Byte one increment higher. This limits the use cases the library can be utilized. My expectation is if the other value for math operations is not a bitmath type, it should be converted to the bitmath type it is being combined with before the math operation is performed.

How to REPRODUCE the issue:

>>> bitmath.Byte(1) + 1
2.0

How REPRODUCIBLE (every time? intermittently? only in certain environments?):
Always

What you EXPECTED to happen:

>>> bitmath.Byte(1) + 1
Byte(2.0)

VERSION of bitmath effected (git hashes are OK). Did you install from RPM, PyPi, source?

  • Version:1.3.1.x
  • Install Source: python3-bitmath-1.3.1-1.fc32.14.noarch

Your OPERATING SYSTEM and the affected PYTHON VERSION:
Fedora 32
Python 3.8.5

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