What are the lesser-known but useful features of the Python programming language?
Quick links to answers:
- Argument Unpacking
- Braces
- Chaining Comparison Operators
- Decorators
- Default Argument Gotchas / Dangers of Mutable Default arguments
- Descriptors
- Dictionary default .get value
- Docstring Tests
- Ellipsis Slicing Syntax
- Enumeration
- For/else
- Function as iter() argument
- Generator expressions
- import this
- In Place Value Swapping
- List stepping
- __missing__ items
- Multi-line Regex
- Named string formatting
- Nested list/generator comprehensions
- New types at runtime
- .pth files
- ROT13 Encoding
- Regex Debugging
- Sending to Generators
- Tab Completion in Interactive Interpreter
- Ternary Expression
- try/except/else
- Unpacking+print() function
- with statement
Source: http://stackoverflow.com/questions/101268/hidden-features-of-python