[EuroPython] What the heck does "pythonic" mean?

Martijn Faassen faassen at infrae.com
Wed Apr 13 12:54:25 CEST 2005

Dario Lopez-Kästen wrote:
> Martijn Faassen wrote:
>> Others already pointed you to 'import this'.
> I think I am very thickheaded - I don't get the 'import this' thing. 
> sorry :-)

Start up the Python prompt, and type 'import this'. Then see what happens.


> I believe, if I understand you correctly, that something is Pythonic 
> when it has a sense of quality, simplicity, clarity and elegance about it.

Though these things are subjective as well, so yes, these things, the 
Python idiomatic way (which itself is an evolving concept).

> This is of course not only limited to python, but I get the point that 
> i.e. Zope does not always fit the shoe, at least not from some 
> perspectives.

Zope 2 definitely doesn't always fit that shoe, though (with effort) it 
is possible to write reasonably modern "Pythonic" code that still fits 
within the Zope framework. Mostly the trick is not to use the framework 
but to write plain Python code when you can get away with it. I think I 
can do that, but it is the result of a lot of experience and an 
experienced Python programmer new to Zope 2 will not know how to do it.

In Zope 3, a lot of effort was taken to allow the integration of 
Pythonic code. Zope 3's codebase itself is also a lot more modern 
Python, so could qualify as "Pythonic" as well. Unfortunately turn-offs 
for Python developers new to Zope 3 are ZCML and the sheer magnitude of 
the framework and the amount of new concepts involved. I believe 
something like ZCML is necessary, but it being an XML glue language, 
it's automatically not perceived as very Pythonic at first impression. 
The magnitude of the framework and new concepts involved is, at least in 
part, a problem for any large framework, not just Zope.

Note that Five is an attempt to bring some of the 'increased 
Pythonicness' (the ability to "just write Python code" without worrying 
about lots of Zope specific things) from Zope 3 to Zope 2.

> I guess this is true of all things; in fact I know it is - "pythonicity" 
> is a pattern or sorts, or an attitude perhaps, and I guess we all use it 
> and judge things by it in one way or another.
> Wether or not you view something as being pythonic or not will, like 
> Martinj in a way suggested, depend on the particular point of view you 
> have or take.

Yes. "this is (not) Pythonic" is therefore of limited use in any 
argument if the other guy doesn't agree, but quite important if the 
other guy *does* agree. :)

> Thanks Magnus and Martinj.

Martijn; an interesting displacement of the 'j' there. :)



More information about the EuroPython mailing list