Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: avoid the redefinition of a function

Reply
Thread Tools

Re: avoid the redefinition of a function

 
 
Terry Reedy
Guest
Posts: n/a
 
      09-12-2012
On 9/12/2012 8:56 AM, Jabba Laci wrote:

> This will call the 2nd function. Now my functions are called step_ID
> (like step_27(), step_28(), etc.). How to avoid the danger of
> redefinition? Now, when I write a new function, I search for its name
> to see if it's unique but there must be a better way.


Before starting to write the new function, write a test and see if it
fails with a "NameError new_name not found". The test failure also
assures one that the test is being run. (I don't always test first, but
I once discovered a test not being run when I modified it in a way that
should have made it fail, but it didn't.)


--
Terry Jan Reedy

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: avoid the redefinition of a function Jabba Laci Python 3 09-13-2012 08:23 AM
Re: avoid the redefinition of a function Tim Chase Python 0 09-12-2012 05:34 PM
Re: avoid the redefinition of a function Michael Torrie Python 0 09-12-2012 01:52 PM
Re: avoid the redefinition of a function D'Arcy Cain Python 0 09-12-2012 01:51 PM
avoid the redefinition of a function Jabba Laci Python 2 09-12-2012 01:15 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57