Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDoug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsGeneral question about Python
Kenneth is advising us to construct variable names in Python as (variable_name_all_in_lower_case). I am used to and really prefer (camelCaseWithNoUnderscores). How big a deal is it in the world at large? I don't want to buck the tide just for the sake of it. But I do prefer camelCase. In the course I think the challenges will require I follow the protocol, so I will.
Just asking.
1 Answer
Gianmarco Mazzoran
22,076 PointsHi,
what Kenneth refer is PEP8, which is one of the Python Enhancement Proposals.
Here's the link to the naming conventions
- Basically when we use
something_all_lower_case
we are refer to a variable or a function. - When we use
SomethingLikeThis
we are refer to a Class object - When we use
SOMETHING_LIKE_THIS
we are refer to an immutable object.
This are just a few example, I suggest you to take a look at the page linked above. So if you follow this criteria you now your code it will be written like that of someone else. So hypothetically every file written in python is written the same way all over the world!
I hope I have given the right information and have helped you!
Doug Hawkinson
Full Stack JavaScript Techdegree Student 25,073 PointsThese conventions make sense now in light of PEP-0008.
Kenneth Love
Treehouse Guest TeacherGreat answer! Only thing I'd say is that SOMETHING_LIKE_THIS
isn't necessarily immutable (we don't have much that's immutable in Python), but it's the convention for a constant which is expected to not change during execution. It's not enforced, though.
Gianmarco Mazzoran
22,076 PointsThanks Kenneth!
And thanks for better explanation!
Albert Reel
5,555 PointsAlbert Reel
5,555 Points*removed to de-clutter.