Help text for Python seems to be incorrect?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 641
- Avg merge
- 12h 4m
- Merged PRs (30d)
- 57
Description
Python Help Text
Describe the bug
https://github.com/microsoft/pxt/blob/master/common-docs/python/classes.md
seems to have a few inaccuracies. I original filed a PR to fix them, but alas I have to withdraw it as my company doesn't allow me to sign the CLA - sorry about that!
I'm no Python expert, so let me know if I have this wrong, but...
- Several classes have members defined like
greeting = "". These are static members, so they're actually not getting used by the constructor and thegreetmethod. They can be removed. - The discussion on public/private/protected isn't quite right. There's nothing stopping you accessing any of the members in Python. The only thing is that prepending
__causes the name to be mangled so you have to do__ClassName__method. The use of_for protected and__for private is just a convention. The error message in the comment# Error: 'name' is privateisn't right. Firstly it should beAnimal("Cat").__nameand secondly the error will be "object has no attribute __name" or something similar. - The section on structural typing isn't right I think. As as far as I know there's no reason why you can't assign the value of
employeetoanimal. It's just a reference and is dynamically typed.
[Or have I misunderstood and is Microbit Python a little 'non-standard' due to it needing to convert to/from JS? I've tried to test out the code in MakeCode but have been running into issues like https://github.com/microsoft/pxt-microbit/issues/4201]
To Reproduce
N/A
Expected behavior
N/A
Screenshots

Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with common-docs/python/classes.md and review the class members, visibility discussion, and structural-typing section against Python behavior and the reported Micro:bit/MakeCode context. Done means resolving which claims are inaccurate and correcting the affected help text without changing unrelated documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100