__call__ bad style? (was Re: Callable modules?)

Jonathan Hogg jonathan at onegoodidea.com
Thu Jul 25 07:36:02 EDT 2002


On 25/7/2002 11:07, in article 16Q%8.116512$Jj7.2728704 at news1.tin.it, "Alex
Martelli" <aleax at aleax.it> wrote:

> If you think that supplying unrequested infrastructure is good, then
> it's quite consistent that you like __call__.
> 
> I prefer simplicity.  "Do the simplest thing that can possibly work".
> As you're showing, __call__ encourages tossing simplicity away.

Hah. You've got me there :-)

Yes, I believe in adding infrastructure that I know the-day-after-tomorrow,
I'll be glad I did ;-)  'repr' is one of those things. I do a lot of work at
the prompt and being able to examine objects is a critical part of that for
me.

In a similar vein I implement 'toString' for my Java classes as I do my Java
testing and debugging from the Jython prompt.

> It's peculiar that Python as it stands feels pretty good to people
> with such totally divergent underlying philosophies of what software
> development is all about.  I guess, in a way, that's a tribute to
> Python's pragmaticity.  Warts such as N divergent ways to perform
> a task (lambda, instance with __call__, closure, etc) will no doubt
> remain due to both backwards compatibility constraints AND the
> different constituencies pulling in opposite directions, helping
> GvR to keep making his own decisions free from unbalanced "popular
> opinion" push in one direction or another.  Good thing, too:-).

I guess we'll just have to agree to disagree on what counts as a "wart" and
"rare and weird" ;-)

Jonathan




More information about the Python-list mailing list