[Python-ideas] Add 'use warnings' directive, like in Perl
Ethan Furman
ethan at stoneleaf.us
Tue Feb 10 21:35:54 CET 2015
On 02/10/2015 11:53 AM, Eduard Bondarenko wrote:
>
> Well, Perl also dynamic language, but except the usage of the additional analyser tools he provides 'use warning'
> directive and many Perl's developers use this feature.
As has been mentioned, part of the reason for 'use warning' in Perl is because without it, Perl will keep running but
with wrong data; in Python, you get a crash, which (more) clearly shows the source of the problem.
> Why you do not want to add such feature in Python ?
Because it is not necessary. Writing correct programs involves a lot of steps, which includes proper unit tests. Those
tests should uncover such things as unused or misspelled names; many use linters, which can also do that.
> If developer do not want to use this feature and want to use static analyser tools - okay. But what if someone wants to
> checks errata (not even an errors) without the s.a tools ?
What do you mean by errata? Attempting to use an undefined name is definitely an error.
> To my mind some people simply do not know that even dynamic language can do some checks..
That's part of learning the new language.
> I am, as a developer which came from Perl programming language really do not understand how you can agree with this
> behaviour and why you are really do not understand me.
Just because we do not agree with you does not mean we do not understand you.
> Where it is written that dynamic language should not checks such things ?
The language doesn't check anything -- tools do; sometimes, as in Perl, those tools are built in to the primary
executable; sometimes, as in Python, they are separate.
> Seems very strange that Python checks ordinary blocks like 'if', 'else', 'def' statement and others..We could just have
> a big amount of tools to check this.
Python checks what it needs to. It doesn't need to check that a name is valid until it tries to use that name. It is
entirely possible that a name will not exist unless certain things happen; a correct program will not attempt to use a
name that doesn't yet exist; Python cannot tell before executing the program whether that precondition has happened.
> I do not want to create C++ from Python. I just want to correct this situation, when you can not say to interpreter
> "please check at least something!!"
The situation is not wrong. Listen, learn, and grow.
--
~Ethan~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150210/5ab427ef/attachment-0001.sig>
More information about the Python-ideas
mailing list