bbcmicrobit / bbcmicrobit/micropython

__mul__ isn't being called as expected

Open
#522 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
646
Forks
290
PR merge metrics
No merged PRs in 30d

Description

The `__mul__` magic function doesn't seem to be called as expected yet `__add__` is

[This sample](https://github.com/romilly/fractions) will give the expected result (1.0) when run locally with
* `python2` / `python3`
* `micropython (v1.9.3 on 2017-11-01; linux version)`

But when run on m:b fails with
```
TypeError: unsupported types for : 'Fraction', 'int'
```
Build:
```
MicroPython v1.9.2-34-gd64154c73 on 2017-09-01; micro:bit with nRF51822
```
Explicitly calling `__mul__` does give the expected result so I expect something isn't plummed in somewhere

Also worth noting that:
```py
class A:
pass

A() + 1
```
Will generate:
```
TypeError: unsupported types for __add__: 'A', 'int'
```
But `*` just gives unsupported types for *nothing*

Originally discovered by @romilly

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.