Postfix code completion
We have seen the general usage of PyCharm's smart code completion engine—looking at a suggestion list and choosing the item that you want. Here, we are considering using the engine for a specific purpose, that is, postfix code completion. Still working with the string_assert.py file from the previous example, we look at the suggestion list for variable b, and we enter a dot character after it.
Notice the first suggestion—if (if expr). If you are confused and don't know what the .if expression is in Python, you are completely right in thinking that. In fact, if you go ahead and select the option to complete the line of code, you will see that the code will be transformed into the following:
if b:
So, .if is just another ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access