| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
FYI, we have a little discrepancy w/ CPython (3.14) here:
$> python
>>> exit(False)
$> echo $?
0
$> python
>>> exit(True)
$> echo $?
1compared to:
$> gpython
>>> exit(False)
False
$> echo $?
1
$> gpython
>>> exit(True)
True
$> echo $?
1(note the extraneous printouts and the different exit codes.)
Sorry, something went wrong.
|
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)' >>> |
Sorry, something went wrong.
This is not correct, after #255, the behavior is still not exactly like CPython 🥲 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add quit and exit.
In CPython's REPL, there are other ways to quit or exit the REPL without calling a function (by simply typing quit or exit). These names are injected via site.py. Since GPython does not have a site.py, this REPL usage is not implemented
Close: #140