Skip to content

Commit aea7c52

Browse files
committed
readme: Add a screenshot
1 parent b3048b8 commit aea7c52

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Alternatively, the package can be installed manually in both editors:
3737
- enjoy.
3838

3939

40+
## Screenshot
41+
42+
![](https://magicstack.github.io/MagicPython/example.png)
43+
44+
4045
## Changes and Improvements
4146

4247
Overall, the central idea is that it should be easy to notice something odd or

misc/example.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import asyncio
2+
3+
4+
def showcase():
5+
"""Some code to showcase the syntax.
6+
7+
Docstrings are recognized and have an additional scope.
8+
Color schemas can render them differently from other strings.
9+
10+
HACK doctests are highlighted too.
11+
12+
>>> print('''hello
13+
... world''')
14+
"""
15+
16+
@decorator(param='spam')
17+
async def coroutine(db:aio_db.DatabaseConnection) -> List[str]:
18+
r"""A coroutine."""
19+
20+
await logger.log('working\x12with %r', aio_db)
21+
22+
async with db.transaction():
23+
print('Result: {result!r}'.format(result=
24+
await db.query(...)))
25+
26+
# a regular expression
27+
get_regex = lambda: re.compile(
28+
r"""\A
29+
word
30+
(?: # a comment
31+
(?P<fill>.)?
32+
(?P<align>[<>=^]) (?# another comment)
33+
)?
34+
another word\.\.\.
35+
(?:\.(?P<precision>0|(?!0)\d+))?
36+
\Z""",
37+
re.VERBOSE | re.DOTALL)
38+
39+
# NOTE Numbers with leading zeroes are invalid in Python3,
40+
# use 0o...
41+
answer = func(0xdeadbeef + 0b0010001 + 0123 + 0o123 +
42+
# complex numbers
43+
.10e12 + 2j) @ mat
44+
45+
raw_string = R'''No escapes '\' in this \one'''
46+
47+
return NotImplemented

0 commit comments

Comments
 (0)