[Python-ideas] Decorator to avoid a mistake

Sebastian Kreft skreft at gmail.com
Wed Nov 23 16:29:35 EST 2016


Related thread
https://mail.python.org/pipermail/python-ideas/2016-July/041095.html

On Nov 23, 2016 20:30, "François Leblanc" <fleblanc50 at gmail.com> wrote:

>
> I can imagine using a metaclass specialized witch can be activate or
> desactivate but the cost of decorator
> call still be here...
>
> I think its will be a good improvement if we can provide a solution for
> this, and i ask myself if this can be set
>
> in interpreter with a flag to activate for exemple and with no performance
> cost without the flag set, so you
>
> will have the choice and a good way to check youre code.
>
> To have no performance cost perhaps the best way it's to use docstring and
> pylint...
>
>
>
> 2016-11-23 10:10 GMT+01:00 Paul Moore <p.f.moore at gmail.com>:
>
>> On 23 November 2016 at 08:08, François Leblanc <fleblanc50 at gmail.com>
>> wrote:
>> > It's why I'd prefer this integrate in language, but if there no way to
>> get
>> > it without performance cost
>> > I will have a look to a pylint solution...
>>
>> The point here is that if there is a way to get it without a
>> performance cost (I can't imagine there would be, it's got to add a
>> check for whether you're overriding a method at a minimum, but you may
>> be able to come up with something) then you can do that within the
>> language as it stands. It may need a specialised metaclass, but that's
>> not a problem. At least, if it *is* an issue to you, you can argue for
>> having it be the behaviour of the default metaclass once you've
>> demonstrated that it works and doesn't hurt performance. And if there
>> is a performance hit, then having the behaviour as opt-in based on a
>> custom metaclass means that people can choose if they want to pay that
>> cost.
>>
>> Paul
>>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161124/238724c1/attachment.html>


More information about the Python-ideas mailing list