Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×

Comment Re:Python VS PHP (Score 1) 261

I think the white space is mainly a red herring,

I used to be a big fan of white spaces and for small projects it is easy to keep in your head the nesting level at which code should be, but when you are editing someone else's code in a 1000 KLOC project it is much more difficult to remember where it should be. As I said it is an inordinately common source of bugs.

Are those million lines of code in one module? Is the nesting depth greater than 8? Those are indications of poor code organization regardless of language or block style. If your modules are not too big and code is not too deeply nested, the way the language indicates block structure has little interaction with the overall size of the project. I read and write Python code written by me and others all day long and almost never encounter bugs resulting from white space.

Comment Re:Python VS PHP (Score 1) 261

That a consequence of improper polymorphism, not static typing. Again once you get past 100 KLOC it gets very hard to keep types and names straight. You need the compiler/interpreter to flag you went you write ParetoOptimizer instead of ParetoOptimized or some similar type error.

You need something to check for bad names and syntax errors. It doesn't have to be a compiler or interpreter. I run several static code checkers constantly via my editor so I can immediately see if I misspelled a variable name or left off a closing paren or something. If you would run a compiler to check static correctness of C or Java, why not run a checker on Python? There are several commonly used checkers. Here's a discussion comparing their relative merits.

Comment Re:Python VS PHP (Score 1) 261

I do, however, disagree with Guido's statement that "Python is fast enough". Whether it is or not depends entirely on what you're doing. For my purposes I don't think a 12-core computer optimally programmed in assembler would be "fast enough".

It's faster to write code in Python than in C or C++ or Pascal or Java. But Python isn't "fast enough" unless your program is I/O bound. And it's inability to handle multiple processing uints gracefully is a real problem. (Not that anyone has a decent answer to that except the dataflow people and the pure functional language people.) Multiple core machines are now the rule rather than the exception, so the GIL is no longer acceptable. Even Ruby attempts to address that, though they didn't really follow through after considering their library situation.

You're absolutely correct that whether a language implementation is "fast enough" depends totally on the problem being solved. If the program is I/O bound, as most are, Python and many other languages are fast enough. Even if part of the problem is CPU bound, there is usually a lot of code that is not, which is why hybrid C/Python solutions are so common. For example, NumPy can take advantage of multiple CPUs when doing matrix calculations, allowing one do heavy, fast number crunching without writing a line of C.

If you need to do CPU-bound processing in Python code, threads won't help if you're using CPython, but they might if you're using Jython which is JVM implementation that has no GIL. Alternatively, you can use the multiprocessing module which avoids the GIL and a lot of other potential problems with threads at the cost of having to explicitly communicate between processes rather than share data structures directly.

Comment Re:Hardening (Score 1) 261

I wouldn't go back to writing my CGI with C unless there was a no-lawsuits clause.

Write a small module that provides error checking. Always use it. No I/o, including DB, I mean literally NO I/o, except through it. Parameter length checking, character scrubbing, quote imbalance checking, credit card number validation, date validation, range checking, throttling, email validation, URL controls... whatever you need, and you can write it as you need it. If you find you need to make a call to something and you don't have it covered -- then you need it.

Not only is this relatively easy to do, it's instructive and enjoyable work. And you get a heck of a lot of bang for your efforts.

Validation of inputs is always a good idea. It's also a lot easier in a language with real strings and automatic memory management than in C.

Comment Re:Guido is overrated (Score 1) 261

The language works. The libraries work. The programmers like it. And there exist a fairly big set of products and services built from it that are successful as well.

That, is what matters in the end. By your own logic, languages like C shouldn't have existed at all.

The language works. The libraries work. The programmers like it. And there exist a fairly big set of products and services built from it that are successful as well.

That, is what matters in the end. By your own logic, languages like C shouldn't have existed at all.

While I do use Python every day and like it, the fact that lots of people use it is not a good argument for it being a good language. In particular, PHP and C++ are the best counter-examples I know: they should never have existed but are extremely popular. C is a good language because it does what it was designed to do well, which was to give programmers direct access to hardware in a structured way. It is often misused for things that do not need low level hardware access. C++ was not a good language because it started from C's limitations as a low level, hardware-oriented language and tried to make it into a general purpose application language.

Comment Re:What does it mean? (Score 1) 261

Note to Guido himself: if you want Python to be even more useful then make it a recommendation to publishers such as O'Reilly NOT to have so many Monte Python references and NOT to have so many footnotes.

Make the language seem like a joke, it will be viewed as a joke of a language. Not everyone is a Monte Python fan.

I've heard some silly arguments against languages, but complaining about the content of a third-party's books really takes the cake. I suppose you'd rather they used dry, forgettable examples to be considered a "serious" language. BTW, you may be unaware that Guido himself is the origin of the Monty Python references, which include the name itself obviously. I learned Python using the official docs and there are many other alternatives to O'Reilly so if the genius of Monty Python offends you, it will not be forced on you.

Comment Re:Python VS PHP (Score 1) 261

Python has its own set of problems.... The most recent that I had to contend with is the lack of any decent SOAP library and a lack of a decent postgresql library. It seems to have an abundance of half baked libraries/extensions, and the python 3 fiasco has just made it even worse.

Python is a great language in itself, but getting any real work done with it is an exercise in reinventing the wheel.

There are certainly plenty of things that could be better about Python, but you're going to need to be a lot more specific with your rants. What is not decent about psycopg2? What libraries are "half-baked" and why? What exactly is a fiasco about Python 3? If you do a lot of reinventing of the wheel, you may not have encountered the extensive standard library or abundance of good libraries at PyPi.

Comment Re:Web hosting providers slow to offer new PHP (Score 1) 261

Someone should resurrect mod_python.

Its successor is mod_wsgi, but what advantage does this have over, say, FastCGI?

mod_wsgi can be easier to configure than a FastCGI setup. It supports both in-process and out-of-process modes. The former is more like mod_python and the latter is more like FastCGI. That said, the apps I work on run themselves and are accessed via mod_fcgid which is good for the custom control we need.

Comment Re:Not this shit again (Score 1) 404

Actually part of the problem is probably the dinosaur of x86. Frequency isn't king. Remember Celeron. If more operations or larger operations could be completed in a cycle than performance would grow without increasing frequency since shrink would allow the extra transistors to accomplish this. I think Moore's Law is bollocks anyways cause it wasn't meant to foretell anything it was just noting a trend way back when.

To be able to take advantage of the additional transistors provided by Moore's "law," either clock speed must increase or more work must be accomplished in a single clock cycle. It is getting very difficult to increase either of those within a single core. Therefore, the gains must come from additional cores.

Comment Re:Or.. teach devs to use threading as appropriate (Score 5, Insightful) 404

An interesting development, and much needed I fear, but yet another layer of abstraction to allow lazy developers to not have to really bother about knowing what their code is actually doing (that's for the poor SoB who has to maintain it is for...)

Developing software is all about managing complexity. Abstractions are the primary tool used to do so. They are neither inherently good or bad. A large part of writing good software is finding the appropriate abstractions and eliminating inappropriate ones. If an abstraction allows a program to be written more easily with an acceptible level of performance and correctness, it is an appropriate abstraction.

To know what code is "actually doing" is relative. No programmer knows what his code is doing at the level of gates on the chip. It's rarely necessary or even helpful to know what the code is doing at the level of CPU instructions or microinstructions. This is especially true if the code runs on multiple CPUs.

Comment Re:Not this shit again (Score 4, Insightful) 404

Moore's law has nothing to do with performance, numbnuts. Apparently the real geeks left Slashdot ages ago.

Try reading the headline again. Usually, clueless posters have to be reminded to read TFA, but this is ridiculous. As Moore's "law" continues to be mostly true, the added transistors are being used for extra more cores rather than to make one core faster. Most of the cores sit idle most of the time because few programs can use more than one of them at once.

Comment Re:Am I the only one? (Score 1) 861

Reading the comments, it seems I'm the only one here who thinks this is awesome. When it comes to weapons development, this is exactly the sort of weapon we should be cheering for. Whether you agree with the ones using it or not, this is a wonderful thing. A weapon which only works as a shield to block incoming attacks; that is what the weapons used by enlightened countries should have evolved into.

If it works as well as claimed, it is indeed awesome. However, my enthusiasm is muted by the fact that it's needed in the first place. There is no end in sight to the conflict between Israelis, Palestinians and everyone else in the region and plenty of blame to go around.

Comment Re:duh (Score 1) 423

To be fair, it IS illegal to play a dvd on an unlicensed system because, well quite frankly, liddvdcss never paid the license fee and reverse engineered the rather crappy css encryption.

I know that isn't what slashdot wants to hear, but the FBI is there to enforce these kinds of laws, and this IS illegal.

Who said anything about the FBI? TFA was about the Library of Congress and United States Copyright office, neither of which makes ultimate decisions about whether anything I do is illegal. I'm certainly glad that the FBI generally has better things to do than knock down my door because I buy DVDs and play them with an unauthorized player. It should be obvious to everyone that not only is the law completely unreasonable on that issue, but that enforcing it is completely impractical. The issue is not that watching a DVD using libdvdcss is illegal (it is illegal because Congress passed a law saying it is) but that it is a bad law which should be invalidated.

Slashdot Top Deals

"Can you program?" "Well, I'm literate, if that's what you mean!"

Working...