Python Discussion

"Python is an excellent language for learning object orientation. (It also happens to be my favorite OO scripting language.) ... All objects in Python are implemented as hash tables, unlike in Perl, in which you have to choose a representation (or looking at it more optimistically, where you are free to choose the optimal representation)." Sriram Srinivasan, AdvancedPerlProgramming, page 120.


If you're interested in Python then take a look at ZopeApplicationServer at http://www.zope.org. It's built with Python and is the most complete Web application server/object management system I've come across. Oh and I nearly forgot, theres a Zope 'Product' (That's a pre-written application) called ZwiKi which implements a wiki web in Zope. You can have a wiki web up and running in about an hour. - RichardMoon

It took me five minutes to get the reference WikiWiki working on my home machine, and less than an hour to get apache installed. On the other hand, I've spent several hours trying to get zope to work with no luck.


Python's big idea is that almost everything is a writable dictionary: dictionaries, classes, objects, stack frames, modules, etc. It's a very elegant and flexible idea.

Oddly enough, I thought Python's big idea was that everything is a sequence --ShaeErisson

I like PythonLanguage a lot: I think Python supports MultiParadigmProgramming well, and that that's a good thing. In JavaLanguage people seem to use InnerClasses to simulate FunctionalProgramming, which makes things a bit ugly both visually and conceptually. Python seems happier to let you just use a functional style if that's more appropriate. I think this supports beginning programmers by letting them start in a BASIC-like procedural fashion; and supports more advanced programmers by letting them choose an appropriate paradigm for a problem. --MartinPool

(Java comment: Hmmm... From what I've seen, Java programmers use static functions for functional programming (see java.lang.Math), and use InnerClasses for callbacks. Microsoft prefers "member function pointers" (a la C++), and has quoted Sun (out of context, I'm sure) as saying the same thing. -- JeffGrigg)

AnonymousInnerClasses can be used to simulate lambdas. How can static functions be used to simulate any feature which is typical for functional programming languages?


Another vote for PythonLanguage... I found it to be one of the most intuitive languages I've ever worked with -- you can often just guess the syntax and it works. Its other great strength is its scalability; it makes sense from command-line interaction all the way up to large-scale modular programs. The only thing some people find difficult is its syntax -- block structuring is done using indentation. There are no curly brackets so it's best to have an intelligent editor such as Emacs. Some people find it cleaner; some people hate it. --SteveFreeman

Intuitive? Yes! When I started with Python, I could just read a lot of code and understood it immediately. Never experienced the same with any other language. -- MikaelHermansson

It also does excellent support for all things Microsoft, and it's a nice way to lead VB folk out of the wilderness. And of course it can make full use of java classes, even derive from them, and can generate java bytecodes. All the power of perl with none of the cruft - no $@%_ - I like PythonLanguage better than any other language I know. Well, okay, I miss $_, but you know what I mean. --PeterMerel

A couple of years ago I went actively looking for a good scripting language, looking at things like Perl, various scheme implementations, etc. Python was by far the best alternative I found. Scripting languages as a class have a couple of things going for them -- automatic memory management, fast turn around times, and decent built-in resizable data structures. They also tend to have terrible syntaxes (Perl is just bizarre, Scheme is simple and elegant if you're a computer). Python syntax falls more or less into the Algol camp (e.g. C/C++, Pascal, etc) which I still find to be the easiest to actually read. The block structuring solely by indentation has never been a problem -- in C++ I almost never mess up the indentation, but I omit braces or insert extra ones all the time. Python syntax is not quite as clean as it could be -- some functions are provided by functions, some are provided by methods, and the OO syntax is not quite as clean as it could be (but then, compare it to the OO syntax in Perl). Then there is tuple support and ArraySlice notation, which is so cool I don't understand why other popular languages don't do it. --CurtisBartley

I first encountered the slice notation (or notion, at least) in the IconLanguage, and I assume that Icon got it from that ancient language SnobolFour. -- BillTrost


The main attraction of PythonLanguage for me is the recent developments in coding ComponentSoftware, Python makes for a great glue.

I am actively developing one large system, which integrates E-mail, Web, RDMBs and other technologies to bring reports, information etc to user' desktops. The beauty of the Web is that by the time the page has appeared on the User's desktop, they don't care where it came from, as long as it gets there fast enough.

-- KevinMcDermott

That I think is why most people like Python. Other scripting languages just aren't cut out for doing object oriented programming in the ways that Java or Smalltalk do, nor are other scripting languages as well suited as Python for writing full programs instead of glue code. --Anonymous

I'll protest on the above claim, and say that RubyLanguage is at least a clear competitor when comes to object oriented programming and writing full programs. Python has an advantage in interpreter speed and availability of libraries, though. --EivindEklund

I also believe the above claim is jumping a bit. I use Tcl with XoTcl? a fair bit and find the object model to be one of the most satisfying around. --KristofferLawson


One of the things I like about Python is that I can open an editor in a window and the python shell in another. If I have any questions about whether something will work, I can try an immediate SpikeSolution. ---CayteLindner


I love the identation of Python. I think it organizes things more clearly than curly brackets do. If I sound odd or out of place, just accept my opinion and ignore me. ( I just don't quite courage to be bold with wikis yet) -- Anonymous

Why not? You pulled off italic already. Just one more ' :-)

Clearly many people agree with you, since that's a very popular aspect of Python.


Some bits moved to StacklessPython


One thing I don't like about python is that it has too much magic in it. and it's not as consistent as I would like. for example. Why do I have to define '__len__' method for function 'len' to work? Why can't I just call x.len()? all the builtin function use these __xxx__ for magic behavior. That's is just plain ugly. I think ruby is more clean and elegant.

This thread explains the reasons <http://groups.google.com/groups?hl=en&lr=&frame=right&th=d8d0f2a6041233a5&seekm=9dIdd.3712%24EL5.3057%40trndny09>. Beauty is in the eye of the beholder. For me, ruby's "end" is ugly (I realise that there are reasons for it), and its semantic whitespace is truly hideous - far worse than the ugliest corners of standard Python.

len(x) calling x.__len__() isn't magic -- it's the defined protocol (the duck-typed alternative to statically-typed Interfaces in Java) that things that have lengths implement. That isn't magic, that's you not reading the documentation. Just because you don't like functions with two leading and two trailing underscores being chosen to implement protocols doesn't make them magic. In five years of using Python, I've yet to find anything that's actually magical. I think anything that encourages monkey patching as The Way of doing things (or at least inadequately punishes it) immediately and irrevocably loses any claim to cleanliness or elegance. Period.

See also SyntacticallySignificantWhitespaceConsideredHarmful.


CategoryPython


EditText of this page (last edited January 3, 2010) or FindPage with title or text search