Being that python is, to me, a prototyping language, then every possible outcome should be presented to the end user.
A full variety of explanations should be presented to the programmer. On Fri, Dec 13, 2013 at 11:56 PM, Vajrasky Kok <sky....@speaklikeaking.com>wrote: > Greetings, > > When fixing/adding error message for wrong type of argument in C code, > I am always confused, how long the wrong type is the ideal? > > The type of error message that I am talking about: > > "Blabla() argument 1 must be integer not wrong_type". > > We have inconsistency in CPython code, for example: > > Python/sysmodule.c > =============== > PyErr_Format(PyExc_TypeError, > "can't intern %.400s", s->ob_type->tp_name); > > Modules/_json.c > ============ > PyErr_Format(PyExc_TypeError, > "first argument must be a string, not %.80s", > Py_TYPE(pystr)->tp_name); > > > Objects/typeobject.c > =============== > PyErr_Format(PyExc_TypeError, > "can only assign string to %s.__name__, not '%s'", > type->tp_name, Py_TYPE(value)->tp_name); > > So is it %.400s or %.80s or %s? I vote for %s. > > Other thing is which one is more preferable? Py_TYPE(value)->tp_name > or value->ob_type->tp_name? I vote for Py_TYPE(value)->tp_name. > > Or this is just a matter of taste? > > Thank you. > > Vajrasky Kok > _______________________________________________ > 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/dwightdhutto%40gmail.com > -- Best Regards, David Hutto *CEO:* *http://www.hitwebdevelopment.com <http://www.hitwebdevelopment.com>*
_______________________________________________ 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