OO patterns with Python

Michele Simionato mis6 at pitt.edu
Wed Feb 12 09:14:19 EST 2003


Alex Martelli <aleax at aleax.it> wrote in message news:<zCf2a.225038$AA2.8786588 at news2.tin.it>...
> Michele Simionato wrote:
>    ...
> > As many others have said, patterns are not so important in Python.
> 
> Heh -- let me get on record as firmly disagreeing with this.
> 
> Not the SAME patterns you might use in some other language,
> of course, but, Python has its own -- and they're just as
> much of a help to your design (and design maintenance) as
> in any other language.


Alex, I agree with you. I wanted to say "patterns (as are intended in
C++ books) are not so important in Python, (since in Python they can
often implemented as recipes)". I was sloppy (since PEP308 is taking
a lot of time ;) and I dropped the parenthesis. 

> > I would suggest you start from the _Python Cookbook_, which contains
> > quite a lot of good stuff (and a chapter on OOP, too).
> 
> By the way of qualifications, which I think may make my
> above-mentioned opinion of interest, I co-edited that book
> and in particular wrote the introduction to that chapter.
> 
> I also wrote and presented at IPC10 a paper on Python
> *NON*-patterns, see www.aleax.it/Python/5ep.html -- so I'm
> no *rabid fan* of patterns whether they're appropriate or
> not -- but I think some patterns often ARE quite perfectly
> appropriate, in Python just as in other languages (though,
> to repeat, not the same patterns -- appropriate DP's to use
> ARE language dependent, as the authors of the classic book
> "Design Patterns" strongly emphasize too).
> 
> 
> > This has been already suggested, but "repetita iuvant".
> > I think he "Cookbook" is worth its money, whereas I am not sure about
> > some of the more theoretical (as opposed to practical) books on patterns.
> 
> Highly theoretical works can be more appropriate _after_
> one has gained practical grounding in the praxis of some
> field, yes.  And the Cookbook is good to guide you to get
> some of that "practical grounding", I agree.
> 
> 
> Alex

On one hand, I think it is useful to have a common name for something
which is
often used, such as a Singleton, Visitor, etc. On the other hand, as a
matter of personal taste, I don't like books spending hundreds of
pages
discussing doubtful classifications. I haven't read the original one,
though.
Maybe it is better than the books I have seen.

Anyway, to the OP I wanted to suggest that somebody entering in the
OOP field should not start with a theoretical book, but with a
practical one. I think
we agree on that.

                       Michele




More information about the Python-list mailing list