On 5/12/2015 9:56 AM, Steven D'Aprano wrote:

The consensus among the core developers is:

* in general, the harm and inconvenience from accidentally
   shadowing built-ins is not great, and it usually easy to
   spot, debug and prevent;

* when it comes to built-in functions (e.g. sum, map, pow)
   and types (e.g. int, str, list) there are significant and
   important use-cases for allowing shadowing;

   (e.g. the built-in sum function shouldn't prevent other
   modules from providing their own sum function)

* but when it comes to None, True and False, there are no
   significant or important use-cases for shadowing (it is
   almost always a bug, not a feature, to redefine None).

The general principle here is of consenting adults: Python allows you to
shadow built-ins because sometimes it is useful, and the good outweighs the
potential harm. There are a handful of exceptions to that general principle
(e.g. None, True, False, I can't think of any others) because in those
cases the harm (as tiny as it is) outweighs the good.

Having followed Python development for 18 years, I think this is a fair summary.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to