[Tutor] Making a Primary Number List generator

Marc Tompkins marc.tompkins at gmail.com
Thu May 16 00:52:20 CEST 2013


On Wed, May 15, 2013 at 3:43 PM, Oscar Benjamin
<oscar.j.benjamin at gmail.com>wrote:

> On 15 May 2013 22:21, Marc Tompkins <marc.tompkins at gmail.com> wrote:
> > On Wed, May 15, 2013 at 1:02 PM, Alan Gauld <alan.gauld at btinternet.com>
> > wrote:
> >>
> >> And C's printf() returns the number of chars printed.
> >> I actually wish python had followed suit because, as Marc says,
> >> it can occasionally be useful...
> >>
> >
> > I wonder if this would be a good PEP suggestion?  Unlike the switch from
> > print to print(), I think this could be done in a future-proof way...
> >
>
> It would be a bit confusing in an interactive session:
>
> >>> def print_(data):
> ...     print(data)
> ...     return len(data)
> ...
> >>> print_('asd')
> asd
> 3
>
>
I was thinking along the lines of an optional parameter ("verbose" or
something similar), so print() would supply a return value if you asked it
to but keep stumm if you didn't.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130515/2dcb0c55/attachment.html>


More information about the Tutor mailing list