Python 3.6 added another way to do string interpolation that is called "f-strings" or Formatted string literals (PEP 498). The idea behind f-strings is to make string interpolation simpler. To create an f-string, you just need to prefix the string with the letter "f". The string itself can be formatted in much the same way […]
Python has some powerful features that allow you to introspect your code or the code of others. I created the following video tutorial to help you learn how that works. This tutorial is from the Python 101 Screencast Related Articles Python 101: Introspection
February 21, 2017 by
Mike Python 3.5 added more support for Unpacking Generalizations in PEP 448. According to the PEP, it added extended usages of the * iterable unpacking operator and ** dictionary unpacking operators to allow unpacking in more positions, an arbitrary number of times, and in additional circumstances. What this means is that we can now make calls […]
February 16, 2017 by
Mike Python 3.6 added a new module called secrets that is designed "to provide an obvious way to reliably generate cryptographically strong pseudo-random values suitable for managing secrets, such as account authentication, tokens, and similar". Python's random module was never designed for cryptographic use but for modeling and simulation. Of course, you could always use the […]
February 14, 2017 by
Mike Python 3.6 added the ability to create Asynchronous Comprehensions and Asynchronous Generators. You can read about asynchronous comprehension in PEP 530 while the asynchronous generators are described in PEP 525. The documentation states that you can now create asynchronous list, set and dict comprehensions and generator expressions. Their example looks like this: result = [i […]
Python 3.6 added yet another way to do string substitution that they are calling "Formatted String Literals". You can read all about the concept in PEP 498. I take a bit of umbrage here in that the Zen of Python states that There should be one-- and preferable only one --obvious way to do it. […]