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. 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

Reply via email to