Author serhiy.storchaka
Recipients ezio.melotti, mrabarnett, python-dev, serhiy.storchaka, vstinner
Date 2016-12-16.21:30:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481923851.03.0.967859139723.issue28765@psf.upfronthosting.co.za>
In-reply-to
Content
> Hum, sorry, I don't understand what is the issue with adding a few addition checks in the constructor? Is it a matter of speed?

It is a matter of readability and maintainability. Additional checks adds 21 lines of the code, and they hardcode error messages. I copied currently produced error messages, with hardcoded function name and argument numbers. Changes in PyArg* functions or Argument Clinic that could globally enhance error messages would not affect these ones. Changing the function name or the arguments order would need to change error messages.

> I don't understand your "unpythonic" argument.

Sorry, I used bad wording. I meant that this doesn't follow the practice of CPython code. Builtins and extensions often ignore subclassing and use concrete API for simplicity and speed. Especially in internal functions. The interface of _sre.compile() already is made less general, it no longer works with general sequences and mappings. Ignoring subclassing don't make it much worse.
History
Date User Action Args
2016-12-16 21:30:51serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, ezio.melotti, mrabarnett, python-dev
2016-12-16 21:30:51serhiy.storchakasetmessageid: <1481923851.03.0.967859139723.issue28765@psf.upfronthosting.co.za>
2016-12-16 21:30:51serhiy.storchakalinkissue28765 messages
2016-12-16 21:30:50serhiy.storchakacreate