The Python standard library and PEP8
emmanuel.surleau at gmail.com
Mon Apr 20 08:12:03 CEST 2009
> >Allowing for procedural-style programming does not mean that a
> >does not implement (even imperfectly) an OO paradigm.
> "Allowing" is the wrong term here. Python absolutely encourages a
> straightforward procedural style when appropriate; unlike Java, there is
> no attempt to force object orientation everywhere. Appealing to Python's
> "object-oriented" nature when arguing about design decisions and ignoring
> the other programming styles it supports is an indicator that you don't
> really know Python very well.
I don't pretend to :)
> Also, my code sample was itself a trick question. Python has *dynamic*
> object orientation (just as the blurb says), and square() will work
> on any object with a __mul__() method (through the ``*`` syntax), just as
> len() works on any object with a __len__() method. So my code
> demonstrates the way Python's programming styles interleave with each
> other (throw in a listcomp to complete the set).
This is what Carl Banks was saying below (that getting the length of
something was generic operation)... Well, I suppose it sorts of make sense. I
had the feeling that Python had been moving from a more procedural kind of
language to a more object-oriented one (by having the "everything be an
object"). But I'm beginning the see the logic in having a len() function (as
opposed to a design wart).
More information about the Python-list