James J. Besemer wrote:
> I propose that we extend the semantics of "print" such that if the 
> object to be printed is a generator then print would iterate over the 
> resulting sequence of sub-objects and recursively print each of the 
> items in order.

I don't feel like searching for the specific python-dev threads right 
now, but something like this has been suggested before (I think with a 
"%i" formatting code), and Guido felt strongly that the addition or 
removal of a simple print statement shouldn't change the behavior of the 
surrounding code.

Consider code like::

     items = get_generator_or_None()
     for item in items:
         do_something(item)

Now let's say I insert a debugging line like::

     items = get_generator_or_None()
     print "make sure this isn't None:", items
     for item in items:
         do_something(item)

My debugging line now just broke the rest of my code.  That's not good.


The other reason I don't think this PEP should go forward (at least as 
it is) is that Python 3000 is already going to turn the print statement 
into a function (though the exact details of that function have not been 
hashed out yet).  So adding extra cruft to the print statement is kind 
of wasted effort.

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to