[EuroPython] What the heck does "pythonic" mean?
dario at ita.chalmers.se
Tue Apr 12 06:58:33 CEST 2005
[dang! this message was sent before it was finished. apologies for that.
I edited things a bit, too...]
Magnus Lycka wrote:
>>How do you judge if something is "pythonic" or not?
> Typing "import this" at the python prompt is a good beginning.
> I'm sure others can explain this better, but using Zope is
> certainly a very different experience than "normal" Python
> It's always different to work with a "plain" programming
> environment where you "own main()", where you write the code
> which is in charge, and use various libraries to handle various
> aspects of your problem, compared to working with a framework
> such as Zope.
> Every framworks imposes an overhead and its own paradigm, but
> I think Zope might initially feel more strange to Python
> programmers than other frameworks, since it takes quite a while
> before you even get close to coding Python in it... With
> something like Twisted, you are also inside the bounds of a
> framework, and you have to play by its rules, but at least you
> are writing Python code that you save as normal text files from
> the very start. You are not clicking around in some odd HTML
> interface filling in various forms...
But nowadays I do the above every day when I am programming Zope. I am
writing all my code in the Filesystem and then i either CVS or SVN it;
for instance I am using a library that is used in a standalone python
CLI tool and building a web interface to int using Zope/Plone.
And for the application that I am building it is not at all CMS
oriented, it is a an interface to our custom Directory Services and user
account system. In this particular case Zope is used only for it's Web
Is this not "Pythonic" in the sense you mean?
Now, the very same thing you criticise is what I think is a major bonus
point for Zope. Providing ease of use for the end user. I also am one of
the maintainer of big application entirely built with TTW code and
templates, and yes, it is not as easy to maintain as FS code, but I do
not make religious war over it.
From my point of view, I find the notion of dismissing Zope just
because it provides an alternative way of development for end users a
bit strange. Zope provides a full blown environment for all kinds of
users, hardcore hackers and end users alike, so I still don't know what
people mean with Zope not being pythonic.
Maybe people have a hard time understanding that Zope is not *only* for
the Python programmer?
> Besides "The Zen of Python", I think most Python programmers
> live more or less in accordance with the Unix Philosophy. I
> can recommend Mike Gancarz' book The UNIX Philosophy, or you
> can look at http://linuxfinances.info/info/unix.html or
> http://www.faqs.org/docs/artu/ch01s06.html for some clues.
> Python goes far beyond pipes, but trying to keep things small
> and simple, avoiding big monolithic programs and keeping data
> and code as text files are examples of things that seem Pythonic
> to me, but is violated by Zope.
Well, my impression is that this is not 100% true for many python
" Store numerical data in flat ASCII files " - that was easy to say a fw
years back when the world was simpler than it is today. But then Object
orientation came along, and people started to speak of "persistence" and
"serialisation", and different techniques to store objects for easy
consumption, this did not become 100% necessary.
Of course, with XML, it is easier to do portable data, though now that I
write this, I realise that what I mean is for general arbitrary data and
objects, not only numerical data, but I have heard this argument for
non-numerical data too.
" Use software leverage to your advantage
Don't force yourself or others to reimplement functionality; make it
easy to reuse functionality. "
It is my impression that this is not necessarily true in the python
world. In fact I often find it is the exact opposite. I.e. the amount of
framworks for web-publishing, the various libraries for XML-processing
to name two examples. This is certainly true of the Zope world too. I.e.
how many Forum/Board products are there? Loads...
" Worse is better
Cheap and effective beats technically superior but expensive "
This, IMHO, is definetely not true for lots of python code. Lots of
python stuff is sometimes really abstract and almost magical to the
level that even the simplicity of python syntax is no help in trying to
understand the code.
To be honest, I sometimes find it easier to read and understand Perl
code from CPAN than it is to comprehend what some python code does
(caveat empor - it may be that I am not as good a developer as I would
like to be :P. YMMV).
> Perhaps a "Spirit of Python" talk would be useful at the conference.
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.
"...and click? damn, I need to kill -9 Word again..." - b using macosx
More information about the EuroPython