shanenin Posted August 17, 2005 Report Share Posted August 17, 2005 I would like to write good code, it is so east to start writing crap. Is the following bad.lets say I have the following codetestvar = 5def test(testvar): print testvartest(testvar)is it a bad practice to use the name of a variable or function in the definition of function, in particular for naming the parameter. This would seem useful to help document what is happening in your code(helps me remember). It does not seem to cause any problems Quote Link to post Share on other sites
quickbasicguru Posted August 17, 2005 Report Share Posted August 17, 2005 I don't use Python, but I believe that is good practice (a form of commenting). Quote Link to post Share on other sites
shanenin Posted August 17, 2005 Author Report Share Posted August 17, 2005 maybe it would be better to do this testvar = 5def test(_testvar): print _testvartest(testvar) Quote Link to post Share on other sites
jcl Posted August 18, 2005 Report Share Posted August 18, 2005 (edited) Well, it can cause problems if one declaration masks another, and it can be confusing if it isn't clear which binding is being used, but if it's it not a problem for you I wouldn't worry. The important thing is to pick meaningful names. Edited August 18, 2005 by jcl Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.