- Where possible, prefer duck-typing tests than
isinstance
, e.g.hasattr(x, attr)
notisinstance(x, SpecificClass)
- Use modern Python 3.9+ syntax
- Prefer f-strings for formatting strings rather than
.format
or%
formatting - When creating log statements, never use runtime string formatting. Use the
extra
argument and % placeholders in the log message - When generating union types, use the union operator,
|
, not thetyping.Union
type - When merging dictionaries, use the union operator
- When writing type hints for standard generics like
dict
,list
,tuple
, use the PEP-585 spec, nottyping.Dict
,typing.List
, etc. - Use type annotations in function and method signatures, unless the rest of the code base does not have type signatures
In this test, I want to see whether the R1 model can read some C code and explain why the Clang autovectorizer algorithm decided not to compile SIMD instructions for the loop.
I have provided some simplified rules based on the Clang docs and the normal rules of autovectorizing algorithms.
The code is from the CPython code base.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import combinations | |
from collections import namedtuple | |
Card = namedtuple("Card", ["color", "shape", "shade", "number"]) | |
cards = [ | |
Card("red", "diamond", "hollow", 1), | |
Card("green", "squiggle", "solid", 3), | |
Card("red", "oval", "striped", 3), | |
Card("red", "oval", "hollow", 2), |
PyCon US 2024 Talk Notes - Unlocking the Parallel Universe: Sub Interpreters and Free-Threading in Python 3.13
- PyCon 2023 – Eric Snow talk on sub interpreters
- EuroPython 2022 – Sam Gross talk on free-threading
- PyCon 2024 - “Sync vs Async in Python” happening right now
- PyCon 2024 - Building a JIT compiler for Cpython
- PyCon 2024 – Overcoming GIL with sub interpreters and immutability
- “Parallelism and Concurrency” chapter from CPython Internals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _testinternalcapi | |
def get_executors(func): | |
code = func.__code__ | |
co_code = code.co_code | |
executors = {} | |
for i in range(0, len(co_code), 2): | |
try: | |
executors[i] = co_code[i], _testinternalcapi.get_executor(code, i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Testing on CPython3.13a1+ | |
Requires some recent patches from main. | |
pip install hypercorn | |
Have successfully run the following apps: | |
- fastapi==0.99.0 | |
- Flask | |
""" |
Talk notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111*()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all forks that haven't been updated since 2020 | |
gh auth refresh -h github.com -s delete_repo | |
gh search repos \ | |
--owner tonybaloney \ | |
--updated="<2020-01-01" \ | |
--include-forks=only \ | |
--limit 100 \ | |
--json url \ | |
--jq ".[] .url" \ | xargs -I {} gh repo delete {} --confirm |
Links from the AIMQ workshop talk
NewerOlder