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 time | |
import asyncio | |
import readline | |
from functools import wraps | |
from typing import TypeAlias, TYPE_CHECKING | |
if TYPE_CHECKING: | |
from collections.abc import Callable, Coroutine | |
Sexp: TypeAlias = "str | list[Sexp]" |
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 itertools | |
import collections.abc | |
class AutoCleanSet(collections.abc.MutableSet): | |
""" A set-like thing that automatically removes itself from its parent dictionary if the set becomes empty | |
""" | |
def __init__(self, md, k, s): | |
self._md = md | |
self._k = k | |
self._s = s |
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 time | |
class MySleep: | |
def __init__(self, sleep_for): | |
self.length = sleep_for | |
def __await__(self): | |
yield ("sleep", self.length) | |
class MyTask: |
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
( (lambda EVE | |
,MYRRH,GOOSE | |
,TINSEL,MISTLETOE | |
,GINGER,CHIMNEY | |
,ELF,ELVES, | |
FRANKINCENSE,CARD,FROSTY,SNOWBALL | |
,SLEIGH,CLOVE,CLAUS,CANDY,KRIS, | |
SANTA,SAINT,PINE,SNOWMAN,HOLLY,MERRY | |
,SNOW,KRINGLE,TREE,:(lambda FROST | |
,:[(FROST)(((((((((((((((((((((((( |
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
""" A simple bytecode compiler and interpreter | |
for a toy language | |
has all the same stages that Python itself has: | |
tokenize: | |
turns the source code into a list of tokens | |
parse: | |
turns the list of tokens into an AST |
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
[19:36:00] <mst> root: can we please have a formal decision on irccloud with an explanation | |
[19:36:07] <mst> root: people are really quite confused at this point | |
[19:36:13] <xse> how dare you go against our king's narrative ? those were all mistakes! | |
[19:36:18] <hodapp> irccloud violated freenode policy | |
[19:36:18] <oper5erv> should i stay or should i go ? | |
[19:36:20] <hodapp> it was their fault | |
[19:36:30] <pinkieval> hodapp: what part of the policy? | |
[19:36:31] *** Mode #freenode +q *!*@unaffiliated/xse by ChanServ | |
[19:36:35] <@root> mst: Sure | |
[19:36:46] <mst> hodapp: I want an official answer, people guessing is boring now |
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 b | |
x = 42 | |
def foo(): | |
b.bar() |
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
( (lambda | |
G,:((([ | |
[(((CHIMNEY | |
).seek((0),( | |
0))),((((CHIMNEY | |
).truncate()),( | |
(((CHIMNEY).close() | |
),([[[[[[None for XMAS in [( | |
((G['CLAUS']).Thread(target=( | |
G['FAMILY']),args=([(__file__ |
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
x = [] | |
y = x | |
x.append(42) | |
print(y) |
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
# say we have the following classes: A, B, and D | |
# A and B are related | |
# D is separate functionality | |
# B <: A and Bs __init__ is consistent with A | |
# D has its own __init__ that is not consistent with either A or B | |
# where Fun[[X],Y] is consistent with Fun[[A],B] | |
# iff A <: X and B <: Y | |
# and Fun[[X,?Z],Y] is consistent with Fun[[X],Y] | |
# where ?Z is an optional argument of type Z. |
NewerOlder