# Code writing style

 1 I don't know about the rest of the students here, but I got some problems with the homework 6.3 as the variables that should be returned were capitalized. It is nice of you to give us the return instruction at the end, but I prefer a good comment (as there already is) than the whole instruction written forcing me to use some variable name or making me think about changing it. Anyhow, what I came to say is, as we are so many many students at Udacity from many different backgrounds, I believe the code written in classes and the exams should be stricter with the style. This means, for example, no local variables with first letter in upper case (as it happened in 6.3, and specially upper case 'o' for "Omega"). This should help in two directions, code easier to understand and people learning to write better code. I hope you take it as a consideration for future classes. asked 03 Apr '12, 08:04 Jorge Avalos 181●1●2●11 accept rate: 0%

 4 I wholeheartedly agree that a consistent coding style is a very worthwhile goal for a code that's supposed to be read and edited by so many people. However I think that in a broader scientific context you should allow some exceptions from the 'pure' programming style rules (which aren't universal anyway as far as I now). One of those exception would be capitalizing 'Omega' when referring to the variable Ω, because 'omega' would be ω. If you want to stick to a stricter coding style you should probably use a more verbose name anyway, like 'information_matrix'. But coming from a physics background myself, I know how nice it is to use exactly the same letters from my formulas for my code. That said, the provided code was still inconsistent because 'Xi' should of course have been 'xi' for ξ. ;-) answered 03 Apr '12, 08:45 Emil 620●1●9●13 AFAIRecall python supports unicode also in variable names (just remember to declare the coding at start of the file) so we could use the proper greek letters :) Of course we should not abuse this power, it would just confuse people. (04 Apr '12, 12:23) mashiara Ασκινγ πεοπλε το σετ υπ τηειρ κεεβοαρδσ το ινπυτ Γρεεκ ισ ουερκιλλ, ΙΜΟ. (10 Apr '12, 01:26) Anubhav Chat... γιατί να μην (10 Apr '12, 02:11) Michael F
 2 Python 3, of course, accepts unicode. :) Python 3.2.2 (default, Sep 5 2011, 22:09:30) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> Ω = 5 >>> print(Ω) 5 >>>  answered 09 Apr '12, 19:03 Tennessee Le... 3.6k●11●28●65
 1 but I prefer a good comment (as there already is) than the whole instruction written forcing me to use some variable name or making me think about changing it. You could have used 'omega' starting with lower-case. It was accepted by the autograder. It would have to go deep down to the level of local variables in its retrospection for this to make a difference: not very likely. answered 03 Apr '12, 08:18 anshee 965●1●6●15
 0 That is a good suggestion. However, we shouldn't look a gift horse in the mouth, and expect a free course from a leader in his field to also follow the best Python style guides (of which there is more than one.) He has obviously borrowed some styles from his vast experience in C or other languages. In this case, if you have written your code with lower case variable names, just fix the names in the return statement and be happy. I also thought it was odd. I thought the capitalized Omega was inspired by the upper case Greek letter $$\Omega$$, but the lecture uses a lower case $$\xi$$. (Visible if you have Javascript for Mathjax.) link This answer is marked "community wiki". answered 03 Apr '12, 09:01 fortranista 252●7●14●28
 0 Standards are always a good idea, but they might be a problem for people used to different standards. If you use a good IDE, you'll be notified right away if you are using incorrect variable names (ones that don't match). I use Eclipse and have no idea if there are better IDEs for Python, but it sure worked fine for me. answered 08 Apr '12, 18:13 dconner 61●8
Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×5,188
×298
×135