Skip to content

Memory saving for library writer #3

Open
@dglaude

Description

@dglaude

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions