On Tue, 21 Aug 2018 at 11:27, Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Tue, Aug 21, 2018 at 09:06:54AM +0200, Marko Ristin-Kaufmann wrote:
>
> > Is there any chance to introduce these constructs in the language or is it
> > too small a feature for such a big change?
>
> I don't think contracts is a small feature. I think it is a HUGE
> feature, but under-appreciated by most developers. (Probably due to
> unfamiliarity, and the difficulty in using it in a language with no
> syntactic support.)

Agreed. And it sounds like there are a lot of subtleties to contracts
that I certainly hadn't appreciated (I don't know if the same is true
of others). For example,

On Tue, 21 Aug 2018 at 08:08, Marko Ristin-Kaufmann
<marko.ris...@gmail.com> wrote:
>
> I think that these objections miss what actually Daniel Moisset wrote in his 
> message: contracts are more than pre- and post-condition checks on a 
> function. The inheritance of decorators does not imply just inheriting the 
> pre- and post-conditions, but also relaxing and tightening them (represented 
> by "require else" and "ensure then" in Eiffel). If this is to be used 
> effectively in practice with little overhead then we would either need to 
> introduce new syntax to the language or make the compiler improve the byte 
> code on the fly.

I've no idea what "relaxing" and "tightening" of contracts involves,
or how it would translate into Python. So I'd imagine that in order to
put together a proposal for adding contracts to Python, you'd need to
explain what contracts are, and how they work, to get past people's
preconceptions that "they are just assertions". Otherwise, it's likely
to be hard to persuade people of the benefits.

Personally, I don't really think I can comment much further, precisely
because it looks like I don't know enough about what contracts are and
how they'd be used to contribute :-)

Paul
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to