[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-02-01 Thread Xavier G. Domingo
Change by Xavier G. Domingo : -- nosy: +xgdomingo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-22 Thread Nick Coghlan
Nick Coghlan added the comment: I agreed that this idea isn't really baked enough for an RFE yet, so I'm marking this as "postponed" for now. The main requirement for getting it back out of "postponed" state would be having someone that's sufficiently interested to write a PEP and wrangle som

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-19 Thread Sylvain Marie
Sylvain Marie added the comment: Very much interested by the topic. For reference I tried to summarize the status of inline type and value validation here: https://smarie.github.io/python-valid8/why_validation/ And I proposed a solution with a library here https://smarie.github.io/python-val

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-18 Thread Brett Cannon
Brett Cannon added the comment: I agree w/ David that this idea is premature. Plus I say it's easier to make it so -O is more fine-grained so you can leave in asserts but get __debug__ set to False. -- nosy: +brett.cannon ___ Python tracker

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-18 Thread R. David Murray
R. David Murray added the comment: I'm not clear why we want a bug tracker issue for something that is still only an idea. We generally *send* people to python-ideas when they propose half-baked ideas here :) (Not actually saying your idea is half-baked, but it clearly isn't fully baked sin

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since this is intended for argument checking, i.e. testing preconditions, the Eiffel term "require" seems more appropriate. https://www.eiffel.org/doc/eiffel/ET:%20Design%20by%20Contract%20(tm),%20Assertions%20and%20Exceptions#Preconditions -- _

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh I can just imagine the bike-shedding on this one :-) I'm not really convinced this is needed, but for what it's worth I think that given the intended use-case (checking function parameters) ValueError would be a more appropriate default exception type. Th

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-17 Thread Nick Coghlan
New submission from Nick Coghlan : This proposal is an outcome of repeated requests on python-ideas that assert statements be made unconditional, so they can be legitimately used for parameter validation, rather than solely as a form of inline self-test. Rather than changing the assert stateme