On Mon, Oct 9, 2017 at 10:04 PM, John Black <[email protected]> wrote:
> In article <[email protected]>, [email protected] 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. Or even code that
use kwargs.setdefault('sep', ''). The above code is wrong in a way
that leads to a TypeError. Can you see the problem?
--
https://mail.python.org/mailman/listinfo/python-list