473,545 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"static" checking

I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.

I usually do try to isolate the new parts of my code, and run them first
with some dummy data that will run fast. But that is not always possible
because of dependencies, and it would be nice to have some sort of sanity
check up front.

I noticed there is a "check" function in IDLE, and I've tried running it but
it never does anything. Maybe it is not catching the kinds of errors that
are biting me.

thanks,
MB
Jul 18 '05 #1
3 1532
On Thu, 29 Jan 2004 04:37:17 +0000, Moosebumps wrote:
I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line).


Check in IDLE isn't bad. I'm not sure what it's running. I know that it
runs tabnanny and probably runs pychecker also. Pychecker is quite handy.

Tim Ottinger

Jul 18 '05 #2
Le Thu, 29 Jan 2004 04:37:17 +0000, Moosebumps a écrit*:

Hi,
I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.


Have a look at pylint (http://www.logilab.org/projects/pylint)

Cheers,

--
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
Jul 18 '05 #3
Moosebumps wrote:

I'm wondering what kind of checking I can do on a python program before
running it (besides reading over every line). I hate running a long python
script, only to have it fail at the end because I misspelled a function
name, or made some other silly mistake that a compiler would normally catch.
Then I have to run it all over again to see what happened or come up with
some sort of short test.

I usually do try to isolate the new parts of my code, and run them first
with some dummy data that will run fast. But that is not always possible
because of dependencies, and it would be nice to have some sort of sanity
check up front.


These issues largely go away once you start doing test-driven development.
See, for example, Mark Pilgrim's excellent introduction in his book at
http://www.diveintopython.org/ (see the link under "unit testing"), or
Kent Beck's paper book "Test-Driven Development" (published by Addison Wesley).

With this approach, your code generally won't have those dependencies
(sometimes the approach has to be tried before someone can really believe
that, but it's true) and you find your spelling mistakes, and many other
problems that static checking can't find, in seconds without no more
effort than it takes to run a batch file.

-Peter
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
4365
by: Alexander Mahr | last post by:
Dear Newsgroup, I'm somehow confused with the usage of the static keyword. I can see two function of the keyword static in conjunction with a data member of a class. 1. The data member reffers in all objects of this class to the same data Or in other word by using the static keyword all objects of one class can share data. (This is...
3
12343
by: Ajax Chelsea | last post by:
can not the "static const int" be replaced by "static enum" anywhere? is it necessary that define special initialization syntax for "static const int"?
12
13437
by: cppaddict | last post by:
Hi, I know that it is illegal in C++ to have a static pure virtual method, but it seems something like this would be useful when the following 2 conditions hold: 1. You know that every one of your Derived classes will need to implement some method, but implement it differently, and that the base class cannot implement it. This is where...
3
1373
by: ruud.bos | last post by:
Hi list, As a C++ newbie, I have a question about static member functions. Suppose I have the following class definition: class MyClass { public: static void MyFunc(); };
9
2296
by: Neil Kiser | last post by:
I'm trying to understand what defining a class as 'static' does for me. Here's an example, because maybe I am thinking about this all wrong: My app will allows the user to control the fonts that the app uses. So I will need to change the fonts depending on what settings the user has entered. However, it seems kind of wasteful to me to go...
11
2121
by: comp.lang.php | last post by:
function blah($item) { if (!isset($baseDir)) { static $baseDir = ''; $baseDir = $item; print_r("baseDir = $baseDir\n"); } $dirID = opendir($item); while (($fyl = readdir($dirID)) !== false) { if (is_dir("$baseDir/$fyl")) blah($item);
16
10800
by: Chris | last post by:
Looking at some code I see a declaration inside a function like static const string s("some string"); Does the static serve any purpose here?
3
5833
by: Steve Folly | last post by:
Hi, I had a problem in my code recently which turned out to be the 'the "static initialization order fiasco"' problem (<http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12>) The FAQ section describes a solution using methods returning references to static objects. But consider:
14
5984
by: Jess | last post by:
Hello, I learned that there are five kinds of static objects, namely 1. global objects 2. object defined in namespace scope 3. object declared static instead classes 4. objects declared static inside functions (i.e. local static objects) 5. objects declared at file scope.
0
7659
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7428
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1887
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1019
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.