microbit-foundation / python-editor-v3

Micro:bit Educational Foundation Python Editor V3
https://python.microbit.org
MIT License
57 stars 36 forks source link

Autocompletion shows more module dunder attributes than available in MicroPython #803

Open microbit-carlos opened 2 years ago

microbit-carlos commented 2 years ago

Bug Description

With a my_module.py file that only contains FOO = 0.

In the Editor:

image

In MicroPython:

MicroPython 569e361 on 2022-06-20; micro:bit v2.0.0 with nRF52833
Type "help()" for more information.
>>> import my_module
>>> dir(my_module)
['__class__', '__name__', 'FOO']
>>> 

I believe some of the dunder features in MicroPython can be enabled/disabled via compile time flags, these are the ones we've got at the minute in V2.

Technically I don't think __class__ is correct, so I've opened this issue in the MicroPython repo, in V1 only __name__ is available:

How To Reproduce

In bug description

Expected behavior

Only show dunder attributes/functions available in MicroPython.

Screenshots

In description.

Environment

N/A

Additional context

N/A