-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/16/2014 04:08 PM, Ryan Smith-Roberts wrote:

> [L]et us return to my original example, getservbyname(). Its current
> signature:
> 
> socket.getservbyname(servicename[, protocolname])
> 
> This is not an inspectable signature, since pure Python does not
> support bracketed arguments. To make it inspectable, we must give
> protocolname a (valid Python) default value:
> 
> socket.getservbyname(servicename, protocolname=None)
> 
> Unfortunately, while useful and inspectable, this signature is not
> correct. For a pure Python function, passing None for protocolname is
> the same as omitting it. However, if you pass None to getservbyname(),
> it raises a TypeError. So, we have these three options:
> 
> 1) Don't give getservbyname() an inspectable signature. 2) Lie to the
> user about the acceptability of None. 3) Alter the semantics of
> getservbyname() to treat None as equivalent to omitting protocolname.
> 
> Obviously #2 is out. My question: is #3 ever acceptable? It's a real 
> change, as it breaks any code that relies on the TypeError exception.

+1 for #3, especially in a new "major" release (w/ sufficient
documentation of the change).


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlLYWU8ACgkQ+gerLs4ltQ6obQCglHmIM4kcNOQte7jj9NjL6Xia
KQwAn2ircAlSR6iwFIAt6PDz0bs6iIDt
=G+GC
-----END PGP SIGNATURE-----

_______________________________________________
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