Skip to content

Memory saving for library writer #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dglaude opened this issue Apr 5, 2021 · 0 comments
Open

Memory saving for library writer #3

dglaude opened this issue Apr 5, 2021 · 0 comments

Comments

@dglaude
Copy link

dglaude commented Apr 5, 2021

So maybe special advice that are for people writing library would be separated.

A library is typically always a *.mpy file... so that advice is not needed anymore.

The library better be split in module, so that if you support multiple hardware, so that user will only import the piece they need.

Not a Python expert, but let's say a module is a folder with a init.py and various other *.py files where a library would be a single library.py file.

https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 is split into piece to permit that kind of import.

There are specific advise for library, such as avoiding to define all kind of constant (like you would do in an Arduino library) but only create those the user will need, not those for internal usage. (I am not expert in how Python treat constant... it seems that except for uppercase name, there is no such thing as a constant).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant