This commit is contained in:
blueloveTH 2024-04-15 01:23:44 +08:00
parent 1cf67220f8
commit 21e5122c44
3 changed files with 5 additions and 5 deletions

View File

@ -60,11 +60,10 @@ assert next(a) == 1
try: try:
next(a) next(a)
exit(1)
except StopIteration: except StopIteration:
pass print("a is exhausted")
``` ```
!!! !!!
Do not change `builtins.next`. It will break some internal functions which rely on `StopIteration` as return value. Do not change `builtins.next`. It will break internal functions which rely on `StopIteration` as return value.
!!! !!!

View File

@ -119,7 +119,7 @@ StackOverflowError
String compilation has no guarantee of compatibility between different versions of pkpy. String compilation has no guarantee of compatibility between different versions of pkpy.
!!! !!!
You can use this snnipet to convert every python file in a directory into precompiled strings: You can use this snnipet to convert every python file in a directory into precompiled strings.
```python ```python
# precompile.py # precompile.py
@ -127,6 +127,7 @@ import sys, os
def precompile(filepath: str): def precompile(filepath: str):
"""Precompile a python file inplace""" """Precompile a python file inplace"""
print(filepath)
with open(filepath, 'r') as f: with open(filepath, 'r') as f:
source = f.read() source = f.read()
source = compile(source, filepath, 'exec') source = compile(source, filepath, 'exec')

View File

@ -3,7 +3,7 @@ output: .retype
url: https://pocketpy.dev url: https://pocketpy.dev
branding: branding:
title: pocketpy title: pocketpy
label: v1.4.4 label: v1.4.5
logo: "./static/logo.png" logo: "./static/logo.png"
favicon: "./static/logo.png" favicon: "./static/logo.png"
meta: meta: