[Tutor] Re: What is "pythonic"?

Andrei project5 at redrival.net
Fri Oct 24 15:30:34 EDT 2003


Tom Semple wrote:
> I've seen frequent reference on this list and in other Python resources 
> to the adjective 'pythonic'. For now I am translating "pythonic" as 
> "takes good advantage of the expressive qualities of the Python 
> language". However, as a newcomer to the language, I'm finding this 

Type "import this" in your Python interpreter :).

Also read this: 
http://mail.python.org/pipermail/python-list/2003-April/158825.html

> translation doesn't always allow me to understand the point that is 
> being made (especially when there is no attempt to elaborate beyond a 
> bland assertion that some code is or is not 'pythonic'). Can anyone 
> suggest some resources that have a number of code examples that 
> illustrate 'pythonic' vs. 'non-pythonic' style?

Unpythonic is doing lots of type checking, or trying really hard to make 
something private/protected. Or using an index to loop through a list 
rather than just doing "for item in mylist". Basically anything people do 
because that's how they do it in other languages, thinking it's as good as 
it gets. Code obsfucation (Perl) is unpythonic too. People you don't like 
fall in the same category. It's a very broad term ;).

> On a related question, I'd like to know more about the philosophy and 
> history of Python. For example, I came across a quote "we are all 
> consenting adults here" I think in explaining why it is not necessary to 
> have type declaration statements in Python, in contrast to other 
> strongly-typed languages. I'm looking for more of that sort of material.

That's the zen of python you get when you import this. You could also look 
at these:

http://www.python.org/doc/essays/

-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.





More information about the Tutor mailing list