views:

120

answers:

3

Are Java style camelCase names good practice in Python. I know Capilized names should be reserved by convention for Class names. Methods should be small letters according to good style, or actually I am not so sure. Is there PEP about naming?

COMMENTS:

Sorry for camels :) , I learned from answer PEP8, that my title is actually properly called mixedCase (Capitalized version is the CamelCase) After reading the PEP, I know that normal small case function naming with underscores should be used for methods also.

+10  A: 

PEP 8 contains all the answers.

Steven Rumbalski
Thanks, thought to ask here instead of Googling as there seem many Java programmers around whose style I consider unpythonic. Oh how I love the Python philosophy: But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!
Tony Veijalainen
+1  A: 

Yes there's a PEP on code style, PEP 8.

Check "Naming Conventions"

theist
+2  A: 

It's best to match whatever your organization uses or is comfortable with. Preaching "the One True Python style" doesn't exactly build harmony if everyone else already uses some other uniform manner. If it's some random hodgepodge of styles, then go ahead and advocate for some unification.

Nick T
It says in the PEP: "A style guide is about consistency.Consistency with this style guide is important.Consistency within a project is more important.Consistency within one module or function is most important."
Tony Veijalainen