camelcasing

Should Python class filenames also be camelCased?

Should Python class filenames also be camelCased? Question: I know that classes in Python are typically cased using camelCase. Is it also the normal convention to have the file that contains the class also be camelCase’d especially if the file only contains the class? For example, should class className also be stored in className.py instead …

Total answers: 5

How to do CamelCase split in python

How to do CamelCase split in python Question: What I was trying to achieve, was something like this: >>> camel_case_split("CamelCaseXYZ") [‘Camel’, ‘Case’, ‘XYZ’] >>> camel_case_split("XYZCamelCase") [‘XYZ’, ‘Camel’, ‘Case’] So I searched and found this perfect regular expression: (?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z]) As the next logical step I tried: >>> re.split("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", "CamelCaseXYZ") [‘CamelCaseXYZ’] Why does this not work, and …

Total answers: 16

Elegant Python function to convert CamelCase to snake_case?

Elegant Python function to convert CamelCase to snake_case? Question: Example: >>> convert(‘CamelCase’) ‘camel_case’ Asked By: Sridhar Ratnakumar || Source Answers: Not in the standard library, but I found this module that appears to contain the functionality you need. Answered By: Stefano Borini For the fun of it: >>> def un_camel(input): … output = [input[0].lower()] … …

Total answers: 30

Why True/False is capitalized in Python?

Why True/False is capitalized in Python? Question: All members are camel case, right? Why True/False but not true/false, which is more relaxed? Asked By: Joan Venge || Source Answers: From Pep 285: Should the constants be called ‘True’ and ‘False’ (similar to None) or ‘true’ and ‘false’ (as in C++, Java and C99)? => True …

Total answers: 4