[Python-Dev] py3k: print function treats sep=None and end=None in an unintuitive way

2008-04-08 Thread Alessandro Guido
Can anybody please point me why print('a', 'b', sep=None, end=None) should
produce "a b\n" instead of "ab"?
I've read http://docs.python.org/dev/3.0/library/functions.html#print, pep-3105 
and some
ml threads but did not find a good reason justifying such a strange behaviour.

Thanks.

-Alessandro Guido
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] py3k: print function treats sep=N one and end=None in an unintuitive way

2008-04-08 Thread Alessandro Guido
Nick Coghlan wrote:
> So that print(a, b) does the right thing (i.e. matches the Python 2.x 
> print statement's behaviour)

AFAICS print(a, b) does the right thing because default values of "sep" and
"end" are ' ' and '\n' respectively, doesn't it?

Eric Smith wrote:
> Because None means 'use the default value'.  You probably want:
> print('a', 'b', sep='', end='')

I think this is a "not optimally designed" API
because you have to read the documentation to understand why

print('a', 'b', sep=None, end=None)

does not translate into the obvious:

«print strings 'a' and 'b' using no separator and no terminator»

but into:

«print strings 'a' and 'b' using the default separator and the default 
terminator»

However i'll just cope with it, Python is still the best language ;)

Thank you all for replying!

-Alessandro Guido
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] py3k: print function treats sep=None and end=None in an unintuitive way

2008-04-22 Thread Alessandro Guido
Can anybody please point me why print('a', 'b', sep=None, end=None) should
produce "a b\n" instead of "ab"?
I've read http://docs.python.org/dev/3.0/library/functions.html#print, pep-3105 
and some
ml threads but did not find a good reason justifying such a strange behaviour.

Thanks.

-Alessandro Guido
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com