On Sat, May 30, 2015 at 2:57 AM, Mike Driscoll <kyoso...@gmail.com> wrote: >> >> Good fun! A few ideas: >> >> How to write decorators, particularly those that take parameters. > > Yes, this one always seems to trip people up.
It's like a Sherlock Holmes pronouncement. When you see something like Flask's app.route(), or functools.wraps(), it's pure magic and completely incomprehensible. But break it down into little pieces (a function that takes a function and returns a function, then decorator syntax, then closures and the ability to call the original, and finally a decorator factory function, which is what a parameterized decorator is), and it becomes elementary. >> The differences between the various number types (int, float, complex, >> Fraction, Decimal) and when you'd want each one. > > I hadn't considered this one It's not often an actual *problem* - I've never seen anyone pick the wrong data type and mess up their code, not in Python - but it's a great way to explore some of the differences between real numbers and what computers work with. Also, I like talking about Fraction and Decimal for the simple reason that they're unobvious; you can poke around with Python and discover int and float, and if ever you need imaginary/complex numbers, you'll quickly come across complex, but you might use Python for years and not realize that decimal.Decimal even exists - nor when you'd want it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list