News for hackers. Stuff that matters.
Re:Writing Python like it's Rust by okasaki on Sunday May 21, 2023 @10:25AM (#36021181)
> I have no idea what is going on from the signature itself. Is records a list, a dict or a database connection? Is check a boolean, or a function? What does this function return? What happens if it fails, does it raise an exception, or return None? [...]

This type of objection is only raised by people who have never seriously used Python before. It sounds convincing that this is a serious flaw in Python, but in practice it never comes up because when you know what domain you're working in it's always immediately obvious what types the arguments are.

Re:Writing Python like it's Rust by Shish2k on Sunday May 21, 2023 @10:39AM (#36021357)
> This type of objection is only raised by people who have never seriously used Python before

How serious is “serious”? Because I’ve worked on millions-of-lines python projects powering billion-dollar companies, and I 100% agree that maintaining untyped python code that somebody else wrote (or that I wrote myself, 6 months ago) is a nightmare for exactly these reasons...

Re:Writing Python like it's Rust by okasaki on Sunday May 21, 2023 @11:22AM (#36021883)
I mean I can't even imagine what would lead anyone to write millions of lines of Python for a single project, so maybe there's a level of serious above what I do. Maybe you're doing it wrong?
Re:Writing Python like it's Rust by esafak on Sunday May 21, 2023 @04:08PM (#36024270)
How many engineers does your company have? When you have thousands it is easy to write millions of lines of code.
Re:Writing Python like it's Rust by dgan on Sunday May 21, 2023 @10:44AM (#36021433)
> it never comes up because when you know what domain you're working in it's always immediately obvious what types the arguments are.

Oh this one is hilariously wrong. Is it InvoiceLine that we are getting here? Or Maybe LineInvoice? Nope those aren't the same. But the only argument is called «line». How shameful. Much sadness. Better add a print statement, push a new build and comeback in twenty minutes

Re:Writing Python like it's Rust by okasaki on Sunday May 21, 2023 @11:23AM (#36021891)
It sounds like the codebase sucks or you haven't taken enough time to understand it.
Re:Writing Python like it's Rust by dgan on Sunday May 21, 2023 @11:54AM (#36022205)
That's beside the point. Those types ("types" you see? hehe) go against your argument "it's obvious from the context", because now it becomes "it's obvious from the context if you are lucky enough that your codebase doesn't suck or you spent 'enough' time figuring it out"
Re:Writing Python like it's Rust by esafak on Sunday May 21, 2023 @04:10PM (#36024281)
Suppose it sucks, and you are expected to contribute it already. Welcome to the real world?
Re:Writing Python like it's Rust by kobzol on Monday May 22, 2023 @03:54AM (#36028570)
I have used Python for 10+ years, and I'm able to forget what are the input arguments/return type of a function after 30 minutes of working on some other part of the code :)