|
Download README.md from Battingchart300/python-bug-fixes: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/datasets/Battingchart300/python-bug-fixes/resolve/main/README.md
- Command line
-
hf download hf://datasets/Battingchart300/python-bug-fixes/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Battingchart300/python-bug-fixes/resolve/main/README.md
1.32 kB
| license: mit | |
| language: | |
| - en | |
| pretty_name: Python Bug Fixes | |
| size_categories: | |
| - n<1K | |
| tags: | |
| - code | |
| - python | |
| - debugging | |
| # Python Bug Fixes | |
| Common Python bugs fixed and explained — real broken scripts with before and after code and what went wrong. | |
| Source: [Battingchart300/python-bug-fixes](https://github.com/Battingchart300/python-bug-fixes) on GitHub (MIT). | |
| ## Data | |
| One record per bug, in `data.jsonl`: | |
| | Field | What it is | | |
| | --- | --- | | |
| | `bug` | Short slug, e.g. `mutable-default-arg` | | |
| | `title` | Human-readable bug name | | |
| | `broken_code` | The buggy version — run it and see the bug happen | | |
| | `fixed_code` | The fixed version — run it and see the correct result | | |
| | `what_went_wrong` | Plain-English explanation of the bug | | |
| | `fix` | Plain-English explanation of the fix | | |
| ## Bugs | |
| | Bug | In short | | |
| | --- | --- | | |
| | `mutable-default-arg` | `def f(x=[])` shares one list between all calls | | |
| | `late-binding-closures` | A `lambda` in a loop sees the last loop value, not the one from its own round | | |
| | `modifying-list-while-iterating` | Deleting from a list while looping over it skips elements | | |
| ## Use | |
| ```python | |
| from datasets import load_dataset | |
| ds = load_dataset("Battingchart300/python-bug-fixes") | |
| print(ds["train"][0]["title"]) | |
| print(ds["train"][0]["broken_code"]) | |
| ``` | |
| ## License | |
| MIT | |