[Python-ideas] Add 'use warnings' directive, like in Perl (original) (raw)
Terry Reedy tjreedy at udel.edu
Wed Feb 11 00:40:41 CET 2015
- Previous message: [Python-ideas] Add 'use warnings' directive, like in Perl
- Next message: [Python-ideas] Add 'use warnings' directive, like in Perl
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/10/2015 11:04 AM, Eduard Bondarenko wrote:
Actually, this is my first experience for writing into the community like this, so excuse me if you found some mistakes or oddities.
Code should be plain plain-text, without markup such as *s around identifiers.
#!/usr/bin/python
word = rawinput("Enter line : ") if word == "hello": print ("You wrote 'hello'") else: if world == "buy": #Error! should be word not world print "Buy"
elif world == "buy": #Error! should be word not world
else: iamnotfunction #Also error
This script contains two errors. And in both cases we will know about it at runtime. And the most worst thing is that you will not know about these errors until someone enters anything other than the "hello" word..
The test suite should test each branch each way. https://pypi.python.org/pypi/coverage/3.7.1 makes this easy.
-- Terry Jan Reedy
- Previous message: [Python-ideas] Add 'use warnings' directive, like in Perl
- Next message: [Python-ideas] Add 'use warnings' directive, like in Perl
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]