How clean/elegant is Python's syntax?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 30 02:18:43 EDT 2013


On Thu, 30 May 2013 02:37:35 +0800, Ma Xiaojun wrote:


> For pure procedural paradigm, I haven't seen much advantages of Python.

Nice syntax with a minimum of boiler plate -- "executable pseudo-code", 
as they say. Extensive library support -- "batteries included". These are 
both good advantages.


> Yes, Python has true OOP but I don't like this argument since I don't
> like Java-ism true OOP.

Java is not the best example of OOP. In some ways, it is a terrible 
example of OOP: some values are not objects, classes are not first-class 
values, and the language is horribly verbose. There are good reasons for 
some of these things, but good reasons or bad, Java is *not* the exemplar 
of OOP that some Java coders believe.

In some ways, Python is a more pure OOP language than Java: everything in 
Python is an object, including classes themselves.

In other ways, Python is a less pure and more practical language. You 
don't have to wrap every piece of functionality in a class. Python 
encourages you to write mixed procedural, functional and object oriented 
code, whatever is best for the problem you are trying to solve, which is 
very much in contrast to Java:

http://steve-yegge.blogspot.com.au/2006/03/execution-in-kingdom-of-
nouns.html


> Yes, Python has much more libraries. But it seems that Python is more
> useful and suitable in CLI and Web applications. 

That is fair. All languages have their strengths and weaknesses. I 
wouldn't use Python to program low-level device driver code, and I 
wouldn't write a web-app in C.


> People are still
> discussing whether to replace tkinter with wxPython or not. VB and VFP
> people are never bothered with such issue.

Which people? "People" can discuss any rubbish they like. For many 
reasons, tkinter will not be replaced. For the standard library, it is a 
good, stable, powerful but not cutting-edge GUI library. If you don't 
like it, you can install a third-party framework like wxPython. Using 
tkinter is not compulsory.

In the case of VB and VFP, they aren't bothered by such issues because 
they're used to closed-source, proprietary programming where you use what 
you are given and like it. In the open-source world, if you don't like 
what you are given, you find something else, and if you can't find it, 
you make it yourself.



-- 
Steven



More information about the Python-list mailing list