Skip to content
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

Typing Examples Please #41

Open
DJDevon3 opened this issue Mar 21, 2024 · 1 comment
Open

Typing Examples Please #41

DJDevon3 opened this issue Mar 21, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@DJDevon3
Copy link

While taking on some "good first issues" the typing issues always seem to popup. Wthout a good prior knowledge of Python types and custom Circuit Python types such as i2c: busio.I2C it's actually much harder than expected. A place that lists most if not all the different types that can be used and examples of their syntax usage would be greatly appreciated. Having that live inside the typing repo as an example or multiple examples seems the most logical place.

Tekktrik suggested making this an issue and volunteered as tribute to do it.

@tekktrik tekktrik self-assigned this Mar 21, 2024
@tekktrik tekktrik added the documentation Improvements or additions to documentation label Mar 21, 2024
@elpekenin
Copy link

You can use the words type and class interchangeably. As such, a list of all of them would not be trivial to gather and keep up to date. And, in my opinion, would not be useful (too many stuff, no good way of finding relevant bits)

As per the syntax, typing in CircuitPython is (at least broadly) the same as doing it in any other Python implementation, every resource in the web about the topic should help getting a grasp of it.

Also, I expect most of the libraries to be using foo: class, foo: Optional[class] and perhaps some foo: Union[class_a, class_b] variables... If my assumption holds true, i'd recommend striking any library you want and learn as you go, as it wouldn't be too hard of a task.

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

No branches or pull requests

3 participants