# Create a reference for newbie common mistakes

## What I suggest

I'd like to open a community wiki post that address and explain the most common beginners bad-practices/mistakes in an XXX language, to be used as a reference when answering.

## Reason

It often happens that someone is asking for a review on an intermediate/advanced level about his code, while presenting very common beginners bad practices or mistakes.

To give an example (with Python), something like:

if len(my_list) == 0:
# ...


I'd have, everytime, to explain to a different person why that shouldn't be done (along with other four or five things like that). This might take a while, maybe even half of my answer without a glance of answer to the main OP concern of review on his code.

This is why I'd like to be able to reference a complete explanaitaion without losing much time. More or less something like:

This line:

if len(my_list) == 0:

Should be replaced with:

if not my_list:

All reasons well explained at Point n.7 here <link>.

[... Going on with the actual review ...]


## Pros

This are the pros that I see:

• Who answer wouldn't have to write the same things again and again to different people
• Who answer could focus his energy on the main problem.
• Who answer wouldn't have to go into details of the feautures of the XXX language.
• It will all be referenced inside CodeReview.
• The asker will find have good and wiki approved explanation.
Some of them might not even be in his posted code, but he might fixed them anyway, and the next time he ask for a review he might present a better code.

What do you think?
Is it doable?
Will be useful?
Could it be improved?

• I like the idea in general, but I think the tag wiki of the language in question would be a better place for this than a community wiki question. – sepp2k Mar 5 '12 at 20:54
• This is a great idea. One other concern of mine is askers being unaware of something as standard as PEP-8 (in the case of Python). It's most important points should be part of the proposed wiki. – tshepang Mar 5 '12 at 23:54
• @sepp2k: I didn't thought it was doable, but it sure looks like a better place :) – Rik Poggi Mar 6 '12 at 10:19
• How do you link to a specific issue if everything is in a single wiki-entry? – Quentin Pradet Mar 7 '12 at 20:43
• I would argue that using the tag wiki isn't sufficient because it doesn't allow for discussion on different suggestions. And as @Cygal mentioned, if people provide detailed explanations for specific answers, those can be directly linked to in the future. – seand Mar 14 '12 at 21:46
• @seand: I'm not sure on how the tag editing process works, but for sure a community wiki is very opened to discussions, suggestions and improvements. – Rik Poggi Mar 15 '12 at 12:26

So far nobody opposed to the creation of these Language References so I'm going to assume there are no major conflicts.

1. Where:
• Commuity wiki post.
• Tag wiki of the language.

At first when the tag wiki option came out I was for it.

But now I'd go with a Community wiki post. It will be:

• Easier to handle.
• Opened to duscussion.
• Easy linkable (this will also solve problem 2).

There will also be the possiblity to link to it from the main meta.codereview page. Like meta.stackoverflow link to its faq. To show what I mean:

Obviously it would be on meta.codereview :)

This could be another advantage of having a post wiki instead of a tag wiki. I don't know if it could be done or not, but it might be something to start thinking about.

• Guidelines for these questions (and their answers) should be established, such as: the question text should be consistent with the only difference between them being the languages, answers should cover 1 code snippet or 1 specific syntax topic, questions should only be added to the reference sidebar when they get X answers. – seand Mar 15 '12 at 15:29
• @seand: If you want it might be good to leave an answer with the guidelines you have in mind :) – Rik Poggi Mar 15 '12 at 17:40

What do you think about a question on meta? Everybody could answer to it and comment the given idioms. It would be easy to link to specific answers from Code Review questions and the language wiki.

I think this discussion is important since it's not only about Python: other languages will follow naturally.

• Hm? Your question was asked ten days ago, and your last comment was nine days ago. I waited to see if you were doing something, but I didn't see anything. I can remove my question if you want. It's not about stealing anything, which is why I'm encouraging community wiki. I'm really sorry if I offended you. – Quentin Pradet Mar 15 '12 at 8:55
• I waited because this community is really slow. I was going to leave an asnwer this morning (to this question), saying that I think that a wiki would be a better idea, hoping that other would join with their answer so that with upvote and downvoted it could have been seen what the community wants and if I got to get consenses I'd have opened a wiki question, maybe with suggestions already gathered from here. (I can't see the point in switching this answer to wiki). – Rik Poggi Mar 15 '12 at 8:59
• What prevents your from leaving an answer right now? It would be the best way to know what is the preferred solution. Whatever the outcome (I don't care that much), the main goal is to create the reference you talked about (which is a great idea of yours), and it looks like we're going to succeed anyway! This makes me happy, not sad. – Quentin Pradet Mar 15 '12 at 9:06
• The fact that the reference already exists. – Rik Poggi Mar 15 '12 at 9:14
• Deleted the question. Someone could create a new question whenever the community reaches consensus on this. – Quentin Pradet Mar 15 '12 at 9:38
• I calmed myself down, you really got me before. I should have politely asked you to remove the question and wait for the community to better express its opinion. (I don't know if it looks like one, but it would be an attempt of apology for this mess of comments). – Rik Poggi Mar 15 '12 at 11:23
• Your answer is basically the same, but with more details. I wouldn't have upvoted myself here! – Quentin Pradet Mar 21 '12 at 8:34