-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Move all loose methods inside modpyb to another class. #1297
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
Comments
Some of the methods that I don't see being part of |
There's nothing particularly "clean" in putting everything to classes. Python is not Java (thanks god), so it makes little sense to enforce artificial restrictions like that. However, there's a "machine" module now, and all those functions really should go there (I skipped mentioning this on @dpgeorge's related comment yesterday, but if you raise it as an additional ticket, here it is). |
Please note that "machine" module is intended to by "pyb" v2-final, so anything going there should be given real good thought. |
Yes, moving those to "time"/"utime" is what I had in mind to propose too. The closest ticket to discuss that is #1225 (because again, we should apply good thought to add to "time" good and consistent API, I even have an idea to run it thru python-ideas list). |
I think @danicampora did in fact mean module. It must be said though: I do like the pyb module being a one-stop-shop for all things microcontroller related. Splitting the functions/classes out into different modules means people need to remember both the module name and the function/class name, instead of just knowing to always use pyb. Having functionality split over many modules also requires good documentation. If time-related functions go in utime then we need to highlight the differences between standard time and utime, pointing out the special functions that are more suited to a microcontroller (eg utime.delay, utime.elapsed_millis). At the moment it's easy to just say "all special functions are in pyb". |
Well, it's clean for me ;-). Anyway the idea was not to put restrictions but to organise things better. |
Well, we have already discussed about making improves in that area, and things are being done. |
Since a lot of the functions are common to other platforms, shouldn't the |
Is it pythonic to call it like that? Did you run that idea thru (e.g.) python-ideas, what feedback from teh general Python community was?
Poor Guido guy, he could have done much better by putting all Python functionality in one module named e.g. "foobar" ;-).
Yes, and #983 is one of the oldest docs-related issue.
pyb.py:
|
Well, what to do then?
|
I wouldn't want to get rid of pyb until such time as I can use dir on some global dictionary to discover what's there. Presumably such a dict exists, and we just need to expose it as sys.modules? |
Superseded by #1430. |
We should move reset, unique_id, interrupt, sleep and so on, to another class (
machine
for instance) to handle all "microcontroller" and non-standard python things. That way modpyb ends up being a clean collection of classes. We should also keep in mind to not makemachine
the place to put all those things that do not fit anywhere else ;-).The text was updated successfully, but these errors were encountered: