Hacker News new | ask | show | jobs
by etskinner 824 days ago
Can you call it pure python if it compiles to React? Seems like the abstraction just makes it harder to debug
2 comments

We need to compile down to React/HTML in the end as it's the only way to render a webpage. By "pure Python" we meant from the developer's perspective they won't have to touch React or Javascript.

We only use React for the UI layer and to send events. Since all the state/logic is kept in Python you won't see Javascript errors during runtime, and debugging can mostly be done in Python land.

Wow, you literally got everything wrong in this comment.

- There are a thousand ways to render HTML, you don't need React at all. Even for interactive pages (see recent alternatives like HTMX, or decade old solutions...)

- If it is converted to JS/React it's obviously not "pure" Python. Sorry, but that's just silly to say that.

- You will definitely see JavaScript errors during runtime, it's inevitable. Maybe not with simple toy projects, but with serious projects, it will happen and will make life miserable.

Sounds RIGHT to me. You need a modern front-end framework like React.js if you want to avoid state / component hierarchy nightmares that you find by doing the same with vanilla JS. Also, the statement of working with pure Python resonates well from the dev perspective. Makes sense to me!
I think they meant that rendering can only be done with JS/HTML, and if you want to use React stuff, React also has to be involved. No need to be rude and assume the worst.

Third point seems true though, I would definitely expect to see JS errors should any React libs have issues on their own.

Would you consider it “pure Python” if it targeted a WASM runtime for the browser side component?
All programming is abstractions, unless you're using machine code. Abstractions don't necessarily make debugging harder -- done the right way, they can make it easier.

(Yes, you can call it "pure python" if it compiles to something else, because every programming language compiles to something else.)

    10100010 00000000
    10111101 00010011 00001000
    10011101 00000000 00000100
    11101000
    11100000 00101100
    11010000 11110101
    01100000
    01010010 01100101 01100001 01101100 
    00100000 01110000 01110010 01101111 
    01100111 01110010 01100001 01101101 
    01101101 01100101 01110010 01110011 
    00100000 01100011 01101111 01100100 
    01100101 00100000 01101001 01110100 
    00100000 01101001 01101110 00100000 
    01100010 01101001 01101110 01100001 
    01110010 01111001 00000000
“ �����,��`Real programmers code it in binary”
> Yes, you can call it "pure python" if it compiles to something else

There is an idea that "pure python" means python + python runtime.

For example, pg8000 is a "pure python PostgreSQL driver", but psycopg is not.

Even though both of them only require Python code from their users.

machine code is very much still an abstraction