This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, mrabarnett, python-dev, serhiy.storchaka, vstinner
Date 2016-11-23.22:03:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479938623.47.0.392808211305.issue28765@psf.upfronthosting.co.za>
In-reply-to
Content
> I don't like it because it adds a cumbersome code for guarding against a case that doesn't happen in practice.

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?


> This is just unpythonic.

Wait, what? I asked you to add checks to not break the Python semantics. If you want to be "Pythonic": you must support the Python semantics, so support when __getitem__, __len__, etc. are replaced.

I don't understand your "unpythonic" argument.


> _sre.compile() is a private function and it is called only with exact types.

Right. So what is the problem with adding more sanity checks?


> Even if it would called with subtypes, most subtypes don't override __len__ and __getitem__. This restriction is too strong.

It's a matter of respecting the Python semantics.
History
Date User Action Args
2016-11-23 22:03:43vstinnersetrecipients: + vstinner, ezio.melotti, mrabarnett, python-dev, serhiy.storchaka
2016-11-23 22:03:43vstinnersetmessageid: <1479938623.47.0.392808211305.issue28765@psf.upfronthosting.co.za>
2016-11-23 22:03:43vstinnerlinkissue28765 messages
2016-11-23 22:03:43vstinnercreate