[Python-Dev] Replacement for print in Python 3.0

Kay Schluehr kay.schluehr at gmx.net
Tue Sep 6 18:39:58 CEST 2005


Nick Coghlan wrote:

> Greg Ewing wrote:
> 
>>Guido van Rossum wrote:
>>
>>
>>>So let's call it the "Swiss Army Knife
>>>(...Not)" API design pattern.
>>
>>
>>Aha! Maybe this is the long-lost 20th principle from
>>the Zen of Python?
> 
> 
> It also sounds like one of the reasons why the ultimates in programming swiss 
> army knives (that is, Lisp macros and Ruby blocks) are unlikely to make an 
> appearance in Python in their full, unconstrained 'glory'. . .

In the context of my proposal it seems to imply some variation of 
Einsteins famous sentence: "Make everything as general as possible but 
not more general" or "Make everything as powerfull as possible but not 
more powerfull". The measure of possibility in this context may be 
serious community requirements. That's why I might have the impression 
that the language doesn't get any *deeper* but it is still very close to 
my actual work and highly usable.

On the other hand I have to admit that I'm not really glad about 3 
functions in favour for one statement. Introducing of a Writer object is 
just a different way of factoring and handling special cases and 
defaults. But I don't believe in an absolute truth about that. I'm not 
an OO stalinist.


> There's an interesting comparison with UI design though - having a couple of 
> different tools in the interface with sensible default behaviour is generally 
> easier to use than a single tool where you have to tell it which behaviour you 
> want all the time (or pick one as the default, and have to remember to tell 
> the application when you want the other behaviour).

Hmm.. Guido cited strip, rstrip and lstrip for a good factoring into 
different functions. To me this is a limit case. It can become annoying 
soon and an API design antipattern. May I remember about C's vprintf, 
vfprintf, vsprintf, vsnprintf or the beauty of execl, execle, execlp, 
execlpe, execv, execve, execvp, execvpe? That's so grotesque that I feel 
deeply connected to Xah Lees crusade against UNIX in sudden moments ;)

Kay



More information about the Python-Dev mailing list