Readit News logoReadit News
patrickkidger commented on Why don't you use dependent types?   lawrencecpaulson.github.i... · Posted by u/baruchel
thomasahle · 4 months ago
You can do that in python using https://github.com/patrick-kidger/torchtyping

looks like this:

    def batch_outer_product(x:   TensorType["batch", "x_channels"],
                            y:   TensorType["batch", "y_channels"]
                            ) -> TensorType["batch", "x_channels", "y_channels"]:

    return x.unsqueeze(-1) * y.unsqueeze(-2)
There's also https://github.com/thomasahle/tensorgrad which uses sympy for "axis" dimension variables:

    b, x, y = sp.symbols("b x y")
    X = tg.Variable("X", b, x)
    Y = tg.Variable("Y", b, y)
    W = tg.Variable("W", x, y)
    XWmY = X @ W - Y

patrickkidger · 4 months ago
Quick heads-up that these days I recommend https://github.com/patrick-kidger/jaxtyping over the older repository you've linked there.

I learnt a lot the first time around, so the newer one is much better :)

patrickkidger commented on Typst: A Possible LaTeX Replacement   lwn.net/Articles/1037577/... · Posted by u/pykello
Archelaos · 6 months ago
I am using a LaTeX pipeline for creating text, invoices, forms, etc. from snippets stored in a database. It was quite complicated to set up, but the results are very satisfying. In principle, I would like an easier markup language, but am afraid to wast my time trying out something new, just to run into limitations after awhile.

Here are my most important requirements: Multiple columns configurable for meaningful column and page breaks (minimum number of lines in a new column or page). Reliable automatic hyphenation for multiple languages (at least English and German, perhaps French, Italian and Spanish in the future). Pictures in columns with dynamic placing according to the available space. Complex tables and forms with sensible automatic page breaks. Background images. Different areas on the page which are treated like mini-pages. -- Is Typst capable of all that?

patrickkidger · 6 months ago
I think so!

I've not tried a couple of things you mention (e.g. background images) but e.g. for dynamic placing there are libraries like https://typst.app/universe/package/meander

The core of Typst is a pretty featureful well-thought-out FP language. This makes expressing libraries for any piece of functionality very pleasant.

patrickkidger commented on Tinyio: A tiny (~200 line) event loop for Python   github.com/patrick-kidger... · Posted by u/tehnub
tayo42 · 8 months ago
That looks like its only for stub files not __init__.py
patrickkidger · 8 months ago
It also applies to any .py file. (At least in practice with e.g. pyright)

That said, the documentation on this matter is close to nonexistent.

patrickkidger commented on Tinyio: A tiny (~200 line) event loop for Python   github.com/patrick-kidger... · Posted by u/tehnub
b33j0r · 8 months ago
I have a question. Why do you prefix your package files with an underscore?

In fact, you write all of your python like you really have something to hide ;) Like `_Todo`.

Where did you get this pattern?

(I’m way more curious than accusatory. Are people embracing private modules these days as a convention, and I just missed it?)

patrickkidger · 8 months ago
Yup, you(/sibling comments) have it correct, it's to mark it as private.

Not sure where I got it from, it just seems clean. I don't think I see this super frequently in the ecosystem at large, although anything I've had a hand in will tend to use this style!

patrickkidger commented on Tinyio: A tiny (~200 line) event loop for Python   github.com/patrick-kidger... · Posted by u/tehnub
moreati · 8 months ago
In https://github.com/patrick-kidger/tinyio/blob/main/tinyio/__... there's

    from ._core import (
        Loop as Loop,
        sleep as sleep,
        ...
    )
Does using `<name> as <name>` change the runtime behaviour at all? Or is it a stylistic choice?

patrickkidger · 8 months ago
This is how static type checkers are told that an imported object is part of the public API for that file. (In addition to anything else present in that file.)

C.f. "the intention here is that only names imported using the form X as X will be exported" from PEP484. [1]

I'm generally a fan of the style of putting all the implementation in private modules (whose names start with an underscore) and then using __init__.py files solely to declare the public API.

[1] https://peps.python.org/pep-0484/

patrickkidger commented on Tinyio: A tiny (~200 line) event loop for Python   github.com/patrick-kidger... · Posted by u/tehnub
patrickkidger · 8 months ago
Oh neat! This is my library. Happy to answer any questions.

(Though it's really a pretty tiny library that just does what it says on the tin, not sure how many questions there can be. :D )

patrickkidger commented on I don't like NumPy   dynomight.net/numpy/... · Posted by u/MinimalAction
semiinfinitely · 10 months ago
all issues raised are addressed by jax.vmap
patrickkidger · 10 months ago
Went scrolling looking for this! Most of the article is about problems solved in JAX.

Also worth noting the Array API standard exists now. This is generally also trying to straighten out the sharp edges.

patrickkidger commented on VSCode’s SSH agent is bananas   fly.io/blog/vscode-ssh-wt... · Posted by u/zdyxry
csdreamer7 · a year ago
> VSCode is an IDE designed to suffocate the open source alternatives, so that they retain full strategic control

What open source alternatives? Atom was a mess that kept breaking. LSP plugins are now used in almost every featureful editor and have really made editing a lot better. You spent more time configuring Vim and Emacs than they saved you. Microsoft made a really good code editor that set a standard and likely took market share from their own (mostly Windows) Visual Studio.

I do not use it anymore because of the creep of closed source plugins (+ they keep breaking my workflow) but I still think it is a great improvement.

> I wish software was secure by design, like browsers are.

Someone does not remember (or was not around) for the ActiveX or Flash days.

patrickkidger · a year ago
> What open source alternatives?

Helix:

https://github.com/helix-editor/helix/

Like vim, but already has an LSP etc out of the box. Things are already there so the config files are minimal.

patrickkidger commented on Apple Invites   apple.com/newsroom/2025/0... · Posted by u/openchampagne
barbazoo · a year ago
Genuine question, is SMS text delivery unreliable where in certain countries?
patrickkidger · a year ago
I have a US number and live in Switzerland. At least for me, I only receive SMS messages whenever I visit the US -- the rest of the time they're just dropped and I'll never see them.

(Doesn't really bother me, my friends and I all use WhatsApp/etc. anyway.)

n=1 though, maybe this is some quirk of my phone provider.

u/patrickkidger

KarmaCake day290March 13, 2022View Original