News for hackers. Stuff that matters.
Re:Practical Python Programming by pansa2 on Thursday June 18, 2020 @08:54PM (#23569889)
In my experience, the people who love Python are those who are happy with dynamic typing - usually because they only use the language for small projects.

When starting a large project, it would be better to skip Python altogether and use a proper statically-typed language.

Type hints only make sense when you’re working on an existing large Python project - just as Guido was doing at Dropbox when he added them to the language. This is because type annotations are the worst-of-both-worlds - they require the verbosity of static typing and provide few of its benefits.

> This is not a course for software engineers on how to write or maintain a one-million line Python application. I don't write programs like that, nor do most companies who use Python, and neither should you.

Re:Practical Python Programming by ramraj07 on Friday June 19, 2020 @01:12AM (#23571186)
If you already know your project is going to be as big as Dropbox's entire codebase, salut don Corleone!

But otherwise, I feel like trying to choose the language that scales to a million lines sounds like dooming in the beginning itself by over-engineering. I attempted that myself but kept coming back to python because it's fast to code, it's forgiving as hell and its customizable. Once you're used to it's quirks you can breeze through it fast. I'm sure ruby and js have the same as well, and with ts you get better typing, but with the typing you can do with 3.8, I'll argue that python gives the _best_ of both worlds if it's especially mixed with a good IDE like pycharm. If you really want, you can also incorporate pytype or something from the get-go. If my Greenfield project's biggest problem is that python doesn't scale, then I'm a very happy man.

Re:Practical Python Programming by flyinglizard on Friday June 19, 2020 @07:12AM (#23573201)
Python doesn’t scale well beyond one file, one developer, one time write. Once a program needs maintaining, updating, expanding, debugging - the experience quickly deteriorates.
Re:Practical Python Programming by ramraj07 on Friday June 19, 2020 @08:07AM (#23573542)
The codebase I work on now is python and I prefer it to both the java and scala codebases I've worked on before that were much smaller. Python gives a better debugging experience than java and a better updating experience than scala (especially someone else's scala) in my opinion.
Re:Practical Python Programming by at_a_remove on Friday June 19, 2020 @10:06AM (#23574638)
I guess I should ask what you consider a small project. I have some five-digit LOC projects written entirely in Python. I have never noticed this typing issue everyone is very concerned about and am often baffled by the emphasis placed upon it. What am I missing?

I am willing to entertain the idea that I have been very lucky or that I have some programming mannerism which has caused me to skate by this kind of thing, but I just don't get it.

Re:Practical Python Programming by DannyB2 on Friday June 19, 2020 @12:31PM (#23576032)
It is not impossible to create a large program in a dynamic language. It simply requires extreme discipline.

At the same time, it is not impossible to write a large program entirely in assembly language, it just requires extreme discipline, even more so than python.

It's just a question of degree.

But when you DO get a type problem, and in any sizable code base, you WILL, it only manifests AT RUNTIME, and possibly at a customer site or in production, rather than manifesting at compile time.

Re:Practical Python Programming by jakear on Friday June 19, 2020 @11:34AM (#23575477)
It’s certainly possible to write untyped code and have it function, but you’re sacrificing development velocity by requiring both you and future maintainers to manually do all the things that a type checker can do automatically.
Re:Practical Python Programming by at_a_remove on Friday June 19, 2020 @12:40PM (#23576119)
Perhaps I have not run into this because I tend to avoid situations where "velocity" is something within two degrees of me uses as an adjective describing a project.
Re:Practical Python Programming by jakear on Friday June 19, 2020 @01:00PM (#23576374)
Replace it with whatever language you use to describe the rate at which things get done and re-read.
Re:Practical Python Programming by ed25519FUUU on Friday June 19, 2020 @10:40AM (#23574968)
Are you the only one who works on the project? You might not notice it in that case, but the engineer who comes after you will.
Re:Practical Python Programming by at_a_remove on Friday June 19, 2020 @11:15AM (#23575306)
The only times I have heard from people who have worked on projects after me is the odd phone call to thank me for the documentation and the clarity of code, just as an intro to ask me a "what should we do about this?" or some kind of obscure historical follow-up.

Case in point, I had written an apartment search website in Perl. Now, at this point I had been pretty disenchanted with Perl as a whole due to the "there's more than one way to do it" culture combining with the "executable line noise" syntax to give rise to a lot of very impenetrable write-once, read-never-again code from others. So, when I did this, I used real, appropriately-named variables, eschewing the convenience of $_, and I made sure each line of code did one thing and only one thing if at all possible. I did not pack a lot into a line. Each line should be obvious. Where I felt that it might be subject to interpretation, I added comments as to what I was doing and why. Each function had is own comment section which discussed what it was for and why, possible room for improvement, and so on.

Eventually the duty passed to another set of hands, a bunch of students who had never seen Perl (the rise of PHP was strong at that point) and in the follow-up, they mentioned that they found it very straightforward to simply re-write each line.

I heard back in the past few months about one of those very large projects I did in a previous job, just keeping touch with people. I asked about one of my personal pet projects. "No, it just keeps running." "It's very obvious where to make any changes." All Python. No type stuff.

I just don't see what I am missing.

Re:Practical Python Programming by ngcc_hk on Friday June 19, 2020 @11:54AM (#23575691)
Wonder any one with similar experience for js vs ts. Python does not have that ...