@Pierre : what do you think ? (cf below)
TBF I come from JS trying to use Brython. Therefore I don't have much issues with DOM API (except for very niche rules) xD.
> That includes google searches and stackoverflow searches for solutions in JS. The problems are usually issues with the DOM API, not with Brython itself.
The issue is that in order to do that you first need to know :
- that you can use the whole DOM API in Brython (which is a very big deal).
- where the thing you are currently using is from :
- the DOM API : I need to look at MDN doc
- the alternate Brython API : I need to look Brython doc, or to swith to the DOM API if I want to do things not available in the alternate Brython API
- the Brython core : I need to look the Brython doc + some adaptations I have to do on a Python code (e.g. aio for async).
- the Brython helpers : I can only look at it in the Brython doc, and if I want to do something else I know there are not equivalent in the DOM API.
I think this are things all Brython developers needs to understand what they are doing, and where to look at things.
> Most people (including me), when learning a new language / platform / API, don't want to be overloaded with implementation details. I don't care that the DOM listener calls an Event bubbler that passes coordinate info to the parent node (or whatever).
I didn't said to add implementation details to the doc.
> I just wanna know how to click the damn button. Tell me doc ['button_id'].bind (myfunc) and I'll go from there. AKA the cookbook approach.
I understand. But when you'll want to do something not in the cookbook and not in the doc of browser.html, you won't know you can use the DOM API and look at the MDN doc. And you'll spend hours searching the doc, to discover months later there where a little hint in a sentence at the end of a page you didn't though was this important and didn't fully understood at first.
> When intro docs go too deep into explanations and labeling, it gets tedious. Especially when you're just learning the platform.
I don't think it would be tedious to say :
1) Brython offers 2 API :
- Brython API : simple/python-like, recommended for python beginners. (link)
- DOM API : more complete, recommended for JS developpers. (link)
2) /!\ Some python features requires adaptations to work with Brython (link)
3) Brython also offers additional features, take a look at the doc ;)
4) We have some cookbooks (that could be separated in Brython API and DOM API cookbooks ?) (link).
=>Rq: I can write the DOM API cookbooks from the Brython API cookbooks if you are interested.
In the DOM API, ofc don't need to copy the MDN doc. Just say that you just need to import browser.windows, and EVERYTHING is accessible from it as windows is like the python globals(), i.e. contains all JS global symbols. Therefore you access and use the FULL JS API but in Python. Say that they can look at the MDN/W3C doc/tutorials/courses for more details about DOM/JS API (links), as well as :
- Could even give a function to import window content to the globals() in order to be even more JS-like.
- Need to explicit some conversions with null/undefined/None and other tricky stuffs that may arise.
- Just give an example, link to a JS/DOM API cookbook, and I think that's all that is needed.
In the Brython API, add that this is compatible with the DOM API. i.e. you can use both, the Brython to do simple stuffs, and then the DOM API to do more advanced stuff not implemented in the Brython API. Give an example and that's all. In html page, say that "(!) There is other functions from the JS/DOM API \o/, link for more".
The rest, is just moving existing pages into different categories to know what they are about (cf my first message).
> I wouldn't start throwing extraneous detail in there about which APIs it uses and such. That turns off most users.
I don't think so, to the contrary.
If you have 2 types of cookbooks : "JS/DOM API" and "Brython API (recommended)", knowing there are 2 ways of doing it with one way being the recommended/preferred way, it would enable users to understand this fundamental thing : there is a more complete API if needed (the DOM API). It would also helps developers coming from JS to use Brython more easily, or for Python developers wanting to learn web devs to latter switch to JS, or for the one that want more perfs, etc.
Then in the documentation, just putting pages either in DOM-API or Brython-API categories would be enough (cf my first message). And would be very helpful as in case of issue they'd know where to search : MDN ? Brython doc ? etc.
> "That project is suitable for someone with large amounts of time and an endless supply of free labor. Know anyone who fits that bill, hint hint? :)"
I have students, wink, wink xD.
Also I'm planning to make some slide before next (scholar) year