Naming convention (programming): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: date. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox2 | #UCB_webform_linked 1144/2384
Wotb (talk | contribs)
Python and Ruby: removed unecessary sentence
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 279:
[[Python (programming language)|Python]] and [[Ruby (programming language)|Ruby]] both recommend <code>UpperCamelCase</code> for class names, <code>CAPITALIZED_WITH_UNDERSCORES</code> for constants, and <code>snake_case</code> for other names.
 
In Python, if a name is intended to be "[[private member|private]]", it is prefixed by one or two underscores (in Python it's more or less a hack). Private variables are enforced in Python only by convention. Names can also be suffixed with an underscore to prevent conflict with Python keywords. Prefixing with double underscores changes behaviour in classes with regard to [[name mangling#Python|name mangling]]. Prefixing ''and'' suffixing with double underscores - the so-called "dunder" ("double under") methods in Python - are reserved for "magic names" which fulfill special behaviour in Python objects.<ref name=pep8>[https://www.python.org/dev/peps/pep-0008/ Style Guide for Python Code PEP8]</ref>
 
=== R ===