Skip to content

Instantly share code, notes, and snippets.

View thesadru's full-sized avatar
⌨️
professionally adding bloat to your favorite libs

ashlen thesadru

⌨️
professionally adding bloat to your favorite libs
View GitHub Profile
@thesadru
thesadru / chineselog.md
Last active April 6, 2023 18:19
My opinions on the test version of the Asia Pond chinese textbook.

Tones

The historical context is appreciated, but I would recommend marking it as extra information. Many textbooks move extra content into boxes offset to the side of the page. Perhaps something similar could be done here. (The same goes for the cultural facts)

I like that the book explicitly states that it is essential to remember to include the tones when writing pinyin.

It's pretty smart to add a new diacritic for the half third tone, which I am guessing is borrowed from Vietnamese. The note that there are different signs for counting is also a practical mnemonic device. I like it a lot.

Overall, while I already knew some theory, I managed to learn a fair bit.

@thesadru
thesadru / add.py
Created June 14, 2021 12:36
Proper annotation of python's add operator
"""An example of how deep python annotations can go.
Here I show a possible way to annotate an add() function to account for as many cases as possible.
We assume that the add() function simply adds the two numbers and does not call internal __add__ or __radd__ methods.
"""
from typing import Protocol, overload
T_contra = TypeVar('T_contra', contravariant=True)
T_co = TypeVar('T_co', covariant=True)