Python Symbols Reference
Python uses several symbols to organize code and handle data structures. This is a quick reference for those who are used to other languages like C.
Common Symbols
| Symbol | Name | Usage in Python |
|---|---|---|
( ) | Parentheses | Used for function calls, tuples, and expression grouping. |
{ } | Curly Brackets | Used to define dictionaries and sets. |
[ ] | Square Brackets | Used to define lists and for indexing/slicing. |
# | Hash/Pound | Starts a single-line comment. |
: | Colon | Starts an indented code block (like in if, for, or def). |
| | Pipe | Used for dictionary merging (Python 3.9+) or bitwise OR. |
Symbol Grouping
Python relies heavily on whitespace and indentation rather than curly brackets for controlling the flow of code. This is one of the biggest changes coming from languages like C.