Funky Programming
Here are some of Pythons cooler features.
- Multiple Assignments
- This is where more than one variable is given a value at one time.
a, b = 1, 2
This feature makes swapping easy:
a, b = b, a
It is most useful when doing calculations with more than one variable
involved:
a, b = b, a + b
instead of:
c = a
a = b
b = c + b
- Functional Programming
- Python has some support for functional programming in the
lambda keyword, this allows you to create functions
on the fly.
- Pythons Protocols
- All of the syntactic sugars that make Python quick and easy to
program in are available to the program. For example, you create a
class that has the semantics of a list, you can define certain
functions for your class and use all the normal syntax with your
new class.
Prev
Contents
Next
Clinton Roy