On 21/02/2023 19:11, avi.e.gr...@gmail.com wrote:
In your own code, you may want to either design your own functions, or use them 
as documented or perhaps create your own wrapper functions that carefully 
examine what you ask them to do and re-arrange as needed to call the 
function(s) you want as needed or return their own values or better error 
messages.  As a silly example, this fails:

max(1, "hello")

Max expects all arguments to be of compatible types. You could write your own 
function called charMax() that converts all arguments to be of type str before 
calling max() or maybe call max(... , key=mycompare) where compare as a 
function handles this case well.

The key point is that you need to adapt yourself to what some function you want 
to use offers, not expect the language to flip around at this point and start 
doing it your way and probably breaking many existing programs.

Yes, consistency is a good goal. Reality is a better goal.

I don't think overengineering is a good thing. Good design utilizes associativity so a person don't get amazed by inconsistency in things that expected to be similar.

Axy.

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

Reply via email to