Presentation is loading. Please wait.

Presentation is loading. Please wait.

Why I Love Python © 2001 Bruce Eckel MindView, Inc. Training & Consulting 5343 Valle Vista La Mesa, CA 91941 ftp://www.mindview.net/pub/eckel/LovePython.zip.

Similar presentations


Presentation on theme: "Why I Love Python © 2001 Bruce Eckel MindView, Inc. Training & Consulting 5343 Valle Vista La Mesa, CA 91941 ftp://www.mindview.net/pub/eckel/LovePython.zip."— Presentation transcript:

1 Why I Love Python © 2001 Bruce Eckel MindView, Inc. Training & Consulting 5343 Valle Vista La Mesa, CA 91941 Bruce@EckelObjects.com www.MindView.net ftp://www.mindview.net/pub/eckel/LovePython.zip

2 Why I Love Python ©2001 www.BruceEckel.com The language you speak affects what you can think Python is what I use the most to solve my own problems (I think better) Including CGI/e-commerce with MySQL 5-10 times productivity (really!) I’ve been trying to figure out how to explain “why” to people Top 10 reasons I’ve come up with And a few other interesting topics

3 Why I Love Python ©2001 www.BruceEckel.com What I love most: Python is about ME As if Guido said: “Bruce, what can we do to make your programming experience as easy as possible?” No compromises: it’s all about making me more productive

4 Why I Love Python ©2001 www.BruceEckel.com My Language History Age 13: BASIC on HP1000 (HOSRAC.BAS is invented) Age 19: APL for physics. The concept of a "terse language". Basic again, survey courses, Pascal et al. Age 21: Computer engineering, Chips + assembly language Age 22: I begin to understand the value of high-level languages Age 24: Database programming AppleII Basic

5 Age 25: Graduate (finally) with MS, discover C, work in embedded programming (in assembly). I am my own C compiler Age 26: Basic (again) for data analysis and control of wind-tunnel experiments Age 27: Embedded C development. Program 4-bit Harvard architecture machine in assembly. Wrote Assembler in GNU-Lisp. Created (?) primitive C++ mode for Gnu-emacs Start writing for Micro Cornucopia Age 29: University of Washington School of Oceanography with Tom Keffer. Chose C++ over Objective-C for openness. Published “Computer Interfacing with Pascal & C”

6 Age 32: Publish “Using C++” Join ANSI C++ Committee Later: “C++ Inside & Out”, “Black-Belt C++” (edited), “Thinking in C++” Java: “easy translation from C++” Actually took two years Thinking in Python Research mode now, web page with notes at www.BruceEckel.comwww.BruceEckel.com The other books and languages wrapped around me like Jacob Marley’s chains…

7 Why I Love Python ©2001 www.BruceEckel.com A ‘Bout’ of Perl After C++ and Java, seemed amazing Python is executable pseudocode. 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 1998 I would actively encourage my competition to use Perl. Sean True, 30 Mar 1999

8 Why I Love Python ©2001 www.BruceEckel.com Top 10 Reasons Why I Love Python

9 Why I Love Python ©2001 www.BruceEckel.com 10. Reduced Clutter Programs are read more than they are written XP: Consistent formatting really is important Readability and compactness Part of “conservation of complexity” Consistent use of programming idioms improves understandability Rapid understanding The opposite of “more than one way to do it”

10 Why I Love Python ©2001 www.BruceEckel.com 9. It’s not backward-compatible in exchange for pain C++: Backward compatible with C – its strength and its bane Java: more or less with C++ syntax (not too bad, but a lot of typing) Perl: compatible with every hacky syntax of every Unix tool ever invented C# and.NET: backward compatible with previous Microsoft marketing campaigns Javascript: not even compatible with itself

11 Why I Love Python ©2001 www.BruceEckel.com 8. It doesn’t value performance over my productivity C++: can’t let go of C performance Better than C, sure, but still takes forever to get something working; memory leaks are almost impossible to design out Java: Primitive types require awkward coding (primitives “necessary” for speed) As opposed to Python: everything is an object; escape mechanism (extension) for speed

12 Why I Love Python ©2001 www.BruceEckel.com 7. It doesn’t treat me like I’m stupid “Operator overloading is bad because you can make ugly code with it” “finalize( ) does something” “We reviewed Java designs before putting them into the language” “Java has an open development process”

13 Why I Love Python ©2001 www.BruceEckel.com 6. I don’t wait forever for a full implementation of the language Some features we invented in the C++ committee are still not implemented Unused features don’t get tested; circular problem Many C++ vendors say “it’s hard, and no one’s asking for it.”

14 Why I Love Python ©2001 www.BruceEckel.com 5. It doesn’t make assumptions about how we discover errors Is strong static type checking really the only way to be sure? Lack of good static typing in pre-ANSI C was certainly heaps of trouble Doesn’t mean it’s the best solution (More about this later) Errors discovered with real data seem to me to be the hardest to find

15 Why I Love Python ©2001 www.BruceEckel.com 4. Marketing people are not involved “Java is flawless” Microsoft “Visual” “C++” Microsoft happens Of course, Python isn’t immune

16 Why I Love Python ©2001 www.BruceEckel.com 3. I don’t have to type so much … And I don’t have to wade through so much code when I’m reading Conservation of complexity: simplicity really does make a difference But the right typing Not obscure like APL Not endlessly inventive like Perl or FORTH

17 Why I Love Python ©2001 www.BruceEckel.com 2. My guesses are usually right I still have to look up how to open a file every time I do it in Java In fact, most things in Java require me to look something up I can remember many Python idioms because they’re simpler One more reason I program faster

18 Why I Love Python ©2001 www.BruceEckel.com 1. Python lets me focus on concepts No stumbling through Java designs, fighting with C++ compilations or run-time bugs.

19 Why I Love Python ©2001 www.BruceEckel.com Python and “The Tipping Point” Email: possible to carry on dozens of conversations by paper mail, but you don’t. Automating Everything: Possible to write programs to automate every task. But you don’t. Python makes it easy enough Great with Gnu make (my CD build system)

20 Why I Love Python ©2001 www.BruceEckel.com Weak typing Only constraints on an object that is passed into a function are that the function can apply its operations to that object def sum(arg1, arg2): return arg1 + arg2 print sum(42, 47) print sum('spam', 'eggs') “Weak” sounds bad

21 Why I Love Python ©2001 www.BruceEckel.com Weak Typing in C++: Templates #include using namespace std; template R sum(A a, B b) { return a + b; } int main() { string a("one"), b("two") cout (a, b) << endl; cout (1, 2) << endl; }

22 Why I Love Python ©2001 www.BruceEckel.com Weak Typing in Java Reflection, possibly with interfaces

23 interface addable { Object add(Object b);} class X implements addable { public Object add(Object b) { return new Object(); // Test } class AddableNotFoundException extends Exception {} public class WeakTyping { public static Object sum(Object a, Object b) throws AddableNotFoundException { Class[] intfs = a.getClass().getInterfaces(); for(int i = 0; i < intfs.length; i++) if(intfs[i] == addable.class) return ((addable)a).add(b); throw new AddableNotFoundException(); } public static void main(String[] args) throws Exception { X a = new X(); X b = new X(); Object c = sum(a, b); }

24 Why I Love Python ©2001 www.BruceEckel.com Why weak typing isn't weak Upcasting becomes meaningless You write what you want to do, let Python worry about how Argument against weak typing: “errors won’t be found” Like in pre-ANSI C (had no rules) As long as rules are enforced sometime, you’ll find the errors Heresy: run-time is better than compile time

25 Why I Love Python ©2001 www.BruceEckel.com Performance issues Machine performance vs. Programmer Performance Most of the time, which is really more important? C++ is naturally faster -- or is it? with IOStreams, not always

26 Why I Love Python ©2001 www.BruceEckel.com Future Impact Programmer productivity is the most important thing Python excels at rapid creation of maintainable code To increase performance, throw hardware at the problem Multiprocessor machines & stackless Seems like an important direction, even to the point of justifying core language changes

27 Why I Love Python ©2001 www.BruceEckel.com Other Languages C# bores me. Removes the interesting/useful features of both Java & C++. I’d use one of those languages first. Ruby. I’ll wait and see, but my impression is that it doesn’t do more for me than Python (or not more enough).

28 Why I Love Python ©2001 www.BruceEckel.com NerdsOnBicycles.com On the New Zealand bike trip, Bill Venners & I decided it would be a good idea to host technically-themed bike tours Run by a professional company with all the amenities, the “sag wagon” etc. We thought a Python-themed trip might be an interesting beginning Grand Tetons? Send email if interested

29 Why I Love Python ©2001 www.BruceEckel.com Life is Short (You Need Python) OR: No Warrantee Not Fit for Any Particular Purpose (You Need Python)


Download ppt "Why I Love Python © 2001 Bruce Eckel MindView, Inc. Training & Consulting 5343 Valle Vista La Mesa, CA 91941 ftp://www.mindview.net/pub/eckel/LovePython.zip."

Similar presentations


Ads by Google