Eckel why i love python
Speakers PMF Related Books Free with a 30 day trial from Scribd. And Everyone Else's Lindsey Stanberry. Related Audiobooks Free with a 30 day trial from Scribd. Elizabeth Howell. Biwin John , Student. Edson Alvarenga at Hewlett-Packard. Sean Flynn. Zoom Quiet , Software Developer at Kingsoft. Show More. Views Total views. Actions Shares.
No notes for slide. Fundamental Question How much safety can we build into a language? What can you actually get? What does it cost? Perl is executable line noise. Perl is like vice grips.
You can do anything with it, and it's the wrong tool for every job Leaves teeth marks everywhere Perl is worse than Python because people wanted it worse. Larry Wall, 14 Oct I would actively encourage my competition to use Perl. Java 2 is mainstream 1. Also Virtual nio and nnio. The simplest example is the canonical Hello World program.
In Python and several other languages it is one line:. This forces you to use the OO paradigm even when it is not appropriate, like the example above, and add lots of unnecessary boilplate class definitions. By this I mean that not everything is an object, such as primitive types and methods. Being able to pass functions around and create closures and lambdas can simplify a lot of code.
The closest you can get in Java is to use anonymous inner classes for things like callbacks. Every time you do a cast from an Object to a specific type you are doing dynamic type checking - before generics were added in Java 5 this meant every time you used a container class for example. Even when using generic containers some of their type checking is done at runtime. Also every time you have an XML file with class or method names in it them somewhere in the code it has to do a dynamic type check to make sure it matches up with a real class.
So many Java programs still have the alleged "dangers" of dynamic typing but with all the verbosity that Java's static typing forces you to add. I could go on and often do , but I will stop here with the observation that I have seen a lot of code that is simpler, cleaner and less complex in Python than in Java but none the other way around.
If anyone can point me to some then I would love to see it. This is solved in a matter of minutes by writing that utility method with a simple api. And it has been. If that is the strongest criticism than can be directed at Java, I remain distinctly unimpressed.
Almost every single language is based on conquering complexity. There is no other aim worth pursuing. Python definitely has some of the most intuitive syntax of any language IMHO.
Its use of block indenting solves a lot of problems, and most of it is as close to plain language as you should get. I believe the simple syntax of python is a good way of conquering complexity. However, that's the only definitive answer I can give to your other query:. You are asking the question that is the entire core of language theory, which encompasses battles that will probably rage until the end of time.
There are mounds of other developments in language theory like Procedural vs OO vs Functional languages and Aspect Oriented Programming that try to simplify programming.
Look at the latest or any release of a language to see some examples of what's being done to 'conquer complexity'. There is never going be one definitive answer, and a full discussion of each approach would take a few months to read, and would probably completely change by the time your were done.
For me, switching from Java to Python was a big win. I can write code faster, with the same or fewer bugs, and modify it more easily. The code also remains much more readable, so when I come back to it after a couple months I can figure out what it's doing faster and rewrite it without too much trouble when I can't. Java, being strongly typed, requires a lot of work up front to design and maintain correct type definitions.
If you declare a variable as an int , and then decide it should have been a float , you'll need to change that type throughout your program.
Are you storing that value in an array? You'll need to change that type declaration, too. Decide to refactor several classes to share a common interface? You'll have to change function definitions throughout your codebase to handle it. If you have a particularly complicated design, you'll find yourself having to deal with a lot of those issues.
Python also has a lot of support in the language for changing how certain things work. Python decorators, for example, can abstract away a lot of complicated code dealing with caching, or registering functions keeping code maintenance down. Sophisticated IDEs can help maintain your code, but you're better off starting with a less complicated language. Or not, but now that I'm done tooting my own horn you can decide for yourself ;. First of all, I agree wholeheartedly that programming is about reducing complexity.
I also agree that Java does not do a great job at reducing complexity. And it's only been 2 or 3 months since I've used that.
How do you read from a file in Java? Well, honestly I don't know. We didn't do much of it, and it was worse than Scanner. As has been mentioned, the complexity of Java is above and beyond that of any other real language I know, but not quite so bad as " that " language.
I think the main problem with the complexity of Java is found in the example meriton uses in defense of Java. Rather than importing awesome community APIs and implementing them as part of the language, Java has a "core" language and APIs are just an extension of that. I mean, you write your code, put in some certain comments, and at least in Eclipse select an item inside a menu and you have generated some beautiful javadocs.
Even though it's wonderful to have such great documentation, I wonder if it didn't actually evolve out of necessity because looking at a program gives you no clue what Java is doing. Buffered Reader? There are layers and layers of added complexity that could and some argue should be abstracted away. Heck, I can open and read a file in assembly with less fuss than Java. Of course comparing a few lines is really rather trivial and fairly worthless, but the point is that Java often introduces complexity, rather than solves it.
For instance, let's say I want to open a comma separated file without using extra APIs or imports , and store each element in a generic collection.
In Java I don't think you can do it without importing external classes. Of course in reality I think either language just goes to preference, and possibly either genetics or training. Some people feel that static or dynamic types introduce the least complexity. I fall into the latter camp, but I understand the argument. After all, your compiler will complain if you try to pass a different type, and you always know what something is supposed to be, because it's either explicitly declared or cast as such.
Of course that adds the complexity of the casting operation minor as it may be , but it benefits from not having to wonder "How in the world did the integer I passed in turn into a float string?? But when it comes down to it, most people can take a look at a Python program and understand what's going on.
Novice programmers to extremely advanced programmers will be able to comprehend the program and purpose by looking at it. Heck, I just wrote a plugin for Bazaar by a combination of reading the poor documentation and reading the code for the Bazaar built-in functions. It took relatively little effort, and they even have a few custom definitions. The same thing for some golly scripts. When coding stuff in my Java class, I was also able to understand some other classes.
However, I think I was at a severe advantage in that class because the Java concepts are very similar to Python concepts. Yueshen Xu , Lecturer at Xidian University. Show More. Views Total views. Actions Shares. No notes for slide. Why I Love Python 1. Program 4-bit Harvard architecture machine in assembly. Perl is executable line noise. Total views 19, On Slideshare 0. From embeds 0. Number of embeds Downloads Shares 0. Comments 0. Likes You just clipped your first slide!
Clipping is a handy way to collect important slides you want to go back to later. Now customize the name of a clipboard to store your clips. Visibility Others can see my Clipboard.
0コメント