Sign in to follow this  

Bad Python Practice?

Recommended Posts

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 code

testvar = 5
def test(testvar):
   print 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

Share this post

Link to post
Share on other sites

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 by jcl

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this