On 11/14/2013 5:32 PM, Victor Stinner wrote:

I don't like the functions codecs.encode() and codecs.decode() because
the type of the result depends on the encoding (second parameter). We
try to avoid this in Python.

Such dependence is common with arithmetic.

>>> 1 + 2
3
>>> 1 + 2.0
3.0
>>> 1 + 2+0j
(3+0j)

>>> sum((1,2,3), 0)
6
>>> sum((1,2,3), 0.0)
6.0
>>> sum((1,2,3), 0.0+0j)
(6+0j)

for f in (compile, eval, getattr, iter, max, min, next, open, pow, round, type, vars):
  type(f(*args)) # depends on the inputs
That is a large fraction of the non-class builtin functions.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to