PEP 259: Revise to remove context-driven magic from print

David LeBlanc whisper at oz.nospamnet
Thu Jun 14 11:55:07 EDT 2001


In article <d30W6.5254$G4.815982 at newsc.telia.net>, fredrik at pythonware.com 
says...
> Robin Thomas wrote:
> 
> > always seemed to me quite a lame thing
> > I have never exploited that feature
> > print is a novice feature
> > lazy scripts can avoid code breakage with minor edits
> > the softspace crap.
> 
> is this a joke of some kind?  if not, it's clearly the most ignorant
> and arrogant PEP proposal I've ever seen.
> 
> </F>
> 
> 
> 
<rant>I don't see why you consider this a joke, nor do I see the 
ignorance and arrogance which you seem to. I think it's kind of 
unfortunate that an influential person in the python world, such as 
yourself, would swat down someone's idea without even saying why! Quite a 
way to discourage people from having new ideas whether right or wrong. 
</rant>

I think the author has a valid point: that one should expect things to be 
wysiwyg. Notice how Guido's recent suggestion for another change to print 
got rejected. It occurs to me that print has gotten to where it is out of 
the same misguided desire to make life easy for newbies - at the expense 
of making life difficult once you outgrow the training wheels. I do dimly 
recall in the far distant past (the Asia - North America land bridge was 
still there) my own gaffe's with printf in C and forgetting to explicitly 
code a \n all too often. Of course, now that i'm accustomed to a function 
that _does_exactly_what_I_tell_it_to_ without trying to second guess me, 
it give me greater flexibility.

Too bad functions in Python can't take flags like they can in Tcl, thus 
one could say print -nonewline "whatever". Of course IIRC, Tcl's print 
has it's own bits of magic.

Since it's probably too late to fix print() as-is without breaking too 
much existing code, something like a raw_print() or putstring() method 
makes sense to me. I also liked someone's idea of __print__ - if that 
idea was in respect of giving objects the power to (as it where) print 
themselves (return their string representation - so call it asstring()).

Regards

Dave LeBlanc



More information about the Python-list mailing list