In article <mailman.59.1507585675.12137.python-l...@python.org>, 
eryk...@gmail.com says...
> 
> On Mon, Oct 9, 2017 at 10:04 PM, John Black <jbl...@nopam.com> wrote:
> > In article <org8pq$fgm$1...@gioia.aioe.org>, python@example.invalid says...
> >>
> >> Le 09/10/2017 à 18:22, John Black a écrit :
> >> > I want sep="" to be the default without having to specify it every time I
> >> > call print.  Is that possible?
> >>
> >>  >>> oldprint = print
> >>  >>> def print(*args,**kwargs):
> >> ...   oldprint(*args,**kwargs,sep='')
> >> ...
> >>  >>> print(1,2,3)
> >> 123
> >
> > Winner!  Thanks all.
> 
> functools.partial(print, sep='') is the winner, IMO.

Ok, I got that working too after someone told me I have to import 
functools.  Can you explain what it means?  It looks like it is not 
defining another function like the other solutions but is truly changing 
the defaults for the existing function print?

John Black

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to