News for hackers. Stuff that matters.
Re:The cost of forsaking C by bluejekyll on Wednesday October 05, 2016 @11:31AM (#12644691)
Python let's you get stuff done fast, but it's almost more dangerous than C in some respects. Without a compiler, you run the risk of deploying code that will not run, and you don't know until that section of code is actually executed. Requiring a massive set of tests to actually validate your code.

On top of the additional testing, you also will have a performance problem at some point after success. And then people will discuss or even plan for a rewrite in a more performant, language. But we all know that rewrites usually fail to materialize. PoC's turn into products, products turn into companies, and companies bottom lines can't generally spare time and money to rewrite the entire service.

I'm not advocating for C, but I wouldn't put Python up as a comparable thing.

Re:The cost of forsaking C by dragonwriter on Wednesday October 05, 2016 @01:00PM (#12645625)
> Python let's you get stuff done fast, but it's almost more dangerous than C in some respects. Without a compiler, you run the risk of deploying code that will not run

C code that compiles can and does blow up at runtime.

There are languages whose type systems do go a long way toward minimizing the risk of this happening, but C is not really one of them.

Re:The cost of forsaking C by bluejekyll on Wednesday October 05, 2016 @05:01PM (#12647840)
I completely agree. C sucks at runtime. I was trying to point out that Python sucks at runtime too.

I personally wouldn't choose either language for a new project.

Re:The cost of forsaking C by witty_username on Wednesday October 05, 2016 @12:52PM (#12645551)
Having the correct type doesn't guarantee correctness.

As a noob C programmer, in my programs segfaults often occur along with undefined behaviour (which is much worse, as your program will silently give the wrong output).

While in Python, you'd get a traceback which is much easier to debug.

> Requiring a massive set of tests to actually validate your code.

Both require tests to validate your code. Sure, static typing can verify some trivial mistakes, but they can't check that array accesses are in bounds, integer overflow, etc.

Re:The cost of forsaking C by kruczek on Thursday October 06, 2016 @09:02AM (#12652047)
> As a noob C programmer, in my programs segfaults often occur along with undefined behaviour (which is much worse, as your program will silently give the wrong output).

> While in Python, you'd get a traceback which is much easier to debug.

Well, C's segfault will also generate core dump, which is essentially the same thing as Python's traceback - it tells you where the program crashed.

Re:The cost of forsaking C by StavrosK on Wednesday October 05, 2016 @01:04PM (#12645655)
You're actually talking about typed vs untyped, which isn't so much about C vs Python. Python is slowly acquiring static type checking (and it's working rather well nowadays).
Re:The cost of forsaking C by bluejekyll on Wednesday October 05, 2016 @04:59PM (#12647815)
Yes, I should have been clearer that this wasn't in support of C over Python. I'm commenting on the relative safety of Python and the downstream costs of using it.

C is not typesafe either, and blows up for other reasons at runtime.

Re:The cost of forsaking C by StavrosK on Wednesday October 05, 2016 @06:46PM (#12648619)
Yep, agreed. I'm very excited about the optional type checking in Python, and can't wait for it to improve so I can use it in all my projects.