Better HN
topnewbestaskshowjobs
Log inSign up

tusharsadhwani

395 karma · joined May 5, 2021 (5y ago) · 62 submissions

Python developer.

Some of my posts may have broken links, the blog currently lives at https://tush.ar

Submissions

comment 2y ago · link · parent

that's because it's not a reimplementation, it is cpython recompiled to wasm.

2.

IICT: First Compiler Workshop in India(compilertech.org ↗)

5 points · by tusharsadhwani · 2y ago · discuss

comment 2y ago · link · parent

I finished this book, wrote the two implementations in Python and Zig, genuinely one of the best set of projects I've ever built.

comment 2y ago · link · parent

This is already the best API testing client that I have found. It's lightweight, it's snappy, it's intuitive, and it can run on a VPS out of the box over an SSH connection, no proxying needed.

comment 2y ago · link · parent

Yup, it's extract, fork process, cleanup. It's also fairly easy to extend the project to create installers and let the user choose a path to extract in, and I plan on doing that.

I also believe that sending a signal to the parent will be propagated down, but I haven't tested it.

6.

Replacing pyinstaller with 100 lines of code(tushar.lol ↗)

5 points · by tusharsadhwani · 2y ago · discuss

comment 2y ago · link · parent

This is brilliant stuff, a very nice high level explanation that skips everything that would make it too boring for a first time reader.

Adding other resources at the end which explain how it _really_ works under the hood would be great.

comment 3y ago · link · parent

they're beta testing `textual-serve` which does exactly this.

comment 3y ago · link · parent

thanks for the non paywalled link!

comment 3y ago · link · parent

It's true, the truly cursed method should never be used in a project that you actually aim to use. But, I just wanted to see how close I could get to the original idea, regardless of how "bad" the solution ended up being.

The second method indeed goes very far! I've made some very cool libraries and talks with that alone.

comment 3y ago · link · parent

it does!

comment 3y ago · link · parent

you're welcome!

comment 3y ago · link · parent

If you think about it it's no different than wasm already.

And wasm has been accessible for at least 4 years now, and yet nobody has given up react and typescript.

wasm is being used to do compute heavy work efficiently, and giving that data back to js. and this will allow doing that but with the 60 or so years of unix programs that already exist. code reuse to the highest extent. how cool is that?

comment 3y ago · link · parent

requirements.txt doesn't support putting your python version in it

comment 4y ago · link · parent

Projects can't keep using an old compilers because of security patches though. At some point, the old versions are too old to keep the security up to date.

A more common example, what if a library that you use stops supporting the old version, and the latest compatible release of the library has a security vulnerability.

16.

I added C-style for-loops to Python(sadh.life ↗)

8 points · by tusharsadhwani · 4y ago · 1 comment

comment 4y ago · link · parent

The idea came from trio's nurseries I believe.

comment 4y ago · link · parent

it's not like they'll have different user account behaviours for someone living in California at the moment, compared to someone living in the EU.

comment 4y ago · link · parent

not very related, but you might want to check out manim: https://github.com/ManimCommunity/manim

comment 4y ago · link · parent

iirc that was AlexNet, ResNet came 3 years later whose refinements ended up making it better than a human at object detection.

comment 4y ago · link · parent

I can't think of any exceptions to this right away, so you might be right.

But, not having ctx available as an explicit value would make certain ast manipulations, as well as bytecode generation by the interpreter more complicated. This is because in both the scenarios, checking for the context will involve checking the parent, instead of a child. And finding the parent in a tree is often times much harder than a child.

comment 4y ago · link · parent

That's amazing. I'm interested in C# now

comment 4y ago · link · parent

True! Although there's some lints that would require you to parse tokens, such as checking for single vs. double quotes, or number of spaces used for indentation.

However, python has a builtin tokenize module for that as well.

comment 4y ago · link · parent

I'll agree, it's not a good introduction to compilers, but it isn't meant to be.

PLY on the other hand is an amazing resource, thanks for linking it here.

comment 4y ago · link · parent

My bad xD, to my credit it's mentioned later in the article. But you're right, I should add that in the beginning.

comment 4y ago · link · parent

The only major changes that I'm aware of since python3 has been the change with keyword arguments in 3.6, and the deprecation of Index and introduction of Constant more recently. Those are big changes, but relatively small and maintainable imo. What challenges have you faced?

comment 4y ago · link · parent

tree sitter can definitely help with this problem, but so can regular AST parsers, the idea is the same: just add code or grammar that will parse the "invalid" grammar, mark it as invalid, and continue parsing valid code as soon as possible.

Existing code editors like VSCode do exactly this for better syntax highlighting of incomplete code.

comment 4y ago · link · parent

I really wasn't expecting anyone to read all of it, I was afraid people will either find it too trivial or too complex based on skill level. So that's great to hear.

comment 4y ago · link · parent

Thanks!

The stuff that ASTs let you do really flexibly is almost always lost to people because they're not aware of it. A lot of other developers would try to do this with string or regex matching, and that often leads to painful experiences.

123