go-python / gpython

gpython is a python interpreter written in go "batteries not included"
BSD 3-Clause "New" or "Revised" License
870 stars 95 forks source link

builtins id dir function not found #234

Open QGB opened 4 months ago

QGB commented 4 months ago

>>> import builtins
>>> builtins.id
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: "'module' has no attribute 'id'"
>>> 
>>> builtins.dir
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: "'module' has no attribute 'dir'"

vars
QGB commented 4 months ago

sys.modules also not support

QGB commented 4 months ago

>>> exec('print(locals())',{1:2},{})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    FIXME line of source goes here
KeyError: 'FIXME can only have string keys!: 1'

>>> exec('print(locals())',{'1':2},{'3':3})
{'3': 3}

>>> eval('print(locals())',{'1':2},{'3':3})
{'3': 3}