Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Python less error-prone than Java
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Ilpo =?iso-8859-1?Q?Nyyss=F6nen?=, post: 1883455"] While I can see your point, I'd say you are totally in the wrong level here. With Java generics you can sort a list and still keeping the type of the contents defined. This is makes the code less error-prone. But why would you implement binary search as the standard library already has it for both arrays and lists? This is one big thing that makes code less error-prone: using existing well made libraries. You can find binary search from python standard library too (but actually the API in Java is a bit better, see the return values). Well, you can say that the binary search is a good example and in real code you would use the stuff from the libraries. I'd say it is not good example: How often will you write such algorithms? Very rarely. Integer overflows generally are not those errors you run into in programs. The errors happening most often are from my point of view: 1. null pointer errors 2. wrong type (class cast in Java, some weird missing attribute in python) 3. array/list index out of bounds First and third ones are the same in about every language. The second one is one where the typing can make a difference. If in the code level you know the type all the way, there is much less changes of it being wrong. (The sad thing in the Java generics is that it is a compile time only thing and that causes some really weird stuff, but that is too off topic to here.) In python passing sequences for a function and also from a function is very easy. You can very easily pass a sequence as argument list. You can also very easily return a sequence from the function and even split it to variables directly. This is very powerful tool, but it has a problem too: How can you change what you return without breaking the callers? There are many cases where passing an object instead of a sequence makes the code much easier to develop further. What's the point? The point is that neither with Java or Python you want to be doing things in the low level. You really want to be doing stuff with objects and using existing libraries as much as possible. And in that level Java might be less error-prone as it does restrict the ways you can shoot yourself more. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Python less error-prone than Java
Top