Skip to content

Commit b2aef66

Browse files
committed
Move tutorial code in general folder
1 parent c123604 commit b2aef66

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

python-312/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Python 3.12 Demos
2+
3+
This repository holds example code that demos some of the new features in Python 3.12.
4+
5+
## Introduction
6+
7+
You need Python 3.12 installed to run these examples. See the following tutorial instructions:
8+
9+
- [How Can You Install a Pre-Release Version of Python](https://realpython.com/python-pre-release/)
10+
11+
You can learn more about Python 3.12's new features in the following Real Python tutorials:
12+
13+
- [Python 3.12 Preview: Ever Better Error Messages](https://realpython.com/python312-error-messages/)
14+
15+
You'll find examples from all these tutorials in this repository.
16+
17+
## Examples
18+
19+
This section only contains brief instructions on how you can run the examples. See the tutorials for technical details.
20+
21+
### Improved Error Messages
22+
23+
Run [`encoder.py](encoder.py) to create an encoded message like the one shown in the tutorial. You can decode the message using [`decoder.py](decoder.py).
24+
25+
You can swap the import statement to `import d from this` in either of the files to encounter the improved error message:
26+
27+
```python
28+
>>> import d from this
29+
File "<stdin>", line 1
30+
import d from this
31+
^^^^^^^^^^^^^^^^^^
32+
SyntaxError: Did you mean to use 'from ... import ...' instead?
33+
```
34+
35+
In [`local_self.py`](local_self.py), you can see a naive reproduction of another improved error message. Pick apart the example code to learn more about how this was implemented in Python 3.12.
36+
37+
See [Ever Better Error Messages in Python 3.12](https://realpython.com/python312-error-messages/) for more information.
38+
39+
## Authors
40+
41+
- **Martin Breuss**, E-mail: [[email protected]]([email protected])
42+
- **Bartosz Zaczyński**, E-mail: [[email protected]]([email protected])
43+
- **Geir Arne Hjelle**, E-mail: [[email protected]]([email protected])
44+
45+
## License
46+
47+
Distributed under the MIT license. See [`LICENSE`](../LICENSE) for more information.

python312-error-messages/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)