You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A 'get' property on a js object is always shadowed by the built-in 'get' method from dict objects when brought to python. For dicts created directly in python, accessing using the dot operator returns the built-in 'get' method while accessing with square brackets returns the value in the dict for the key of 'get'.
Standalone code to reproduce the issue
import pythonmonkey as pm
jsObj = pm.eval("({get: 'value'})")
print(jsObj.get) # get method of dict object
print(jsObj['get']) # get method of dict object################
pyDict = {"get": "value"}
print(pyDict.get) # get method of dict object
print(pyDict['get']) # 'value'
### Relevant log output or backtrace
```shell
$ python test.py
<built-in method get of dict object at 0x7fb8370eb380>
<built-in method get of dict object at 0x7fb8370eb380>
<built-in method get of dict object at 0x7fb837080080>
value
Additional info if applicable
No response
What branch of PythonMonkey were you developing on? (If applicable)
Activity
philippedistributive commentedon Mar 20, 2024
we can't distinguish between the . operator and the [] (unexpected), but we can make it possible to fetch the get property's value indeed
philippedistributive commentedon Mar 20, 2024
ok found the way to distinguish between the . and the []
philippedistributive commentedon Mar 28, 2024
PR has been merged