◐ Shell
clean mode source ↗

stdlib: Add quit and exit by aisk · Pull Request #254 · go-python/gpython

In CPython, bool type implemented the __index__ method, so True will be treated as 1 and False will be treated as 0 when a number like object is required. In GPython, we don't have this method implemented, thus the difference.

❯ python3
Python 3.14.3 (main, Feb  3 2026, 15:32:20) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> True.__index__()
1
>>>

gpython on  main [?] via 🐹 v1.26.0 via 🐍 v3.14.3 took 10s
❯ ./gpython
Python 3.4.0 (none, unknown)
[Gpython dev]
- os/arch: darwin/amd64
- go version: go1.26.0
>>> True.__index__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: 'unknown bound method type for "__index__": func() (py.Int, error)'
>>>