As explained in my Summer of code 2017: Python post I decided to pick up Python
This is officially day 55. Today I decided to look at some Python Jargon
Here are some of the more interesting ones
Dunder
Dunder (Double Underscore) is a way to pronounce names of special methods and attributes, __len__ is pronouced dunder len, __init__ is pronounced dunder init
BDFL
Benevolent Dictator For Life, a.k.a. Guido van Rossum, Python’s creator.
The canonical implementation of the Python programming language, as distributed on python.org. The term “CPython” is used when necessary to distinguish this implementation from others such as Jython or IronPython.
Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style common to many other languages such as C.
Look before you leap. This coding style explicitly tests for pre-conditions before making calls or lookups. This style contrasts with the EAFP approach and is characterized by the presence of many if statements.
String literals prefixed with 'f' or 'F' are commonly called “f-strings” which is short for formatted string literals. See also PEP 498.
A pseudo-module which programmers can use to enable new language features which are not compatible with the current interpreter.
By importing the __future__ module and evaluating its variables, you can see when a new feature was first added to the language and when it becomes the default
Python 3000
Nickname for the Python 3.x release line (coined long ago when the release of version 3 was something in the distant future.) This is also abbreviated “Py3k”.
An idea or piece of code which closely follows the most common idioms of the Python language, rather than implementing code using concepts common to other languages. For example, a common idiom in Python is to loop over all elements of an iterable using a for statement. Many other languages don’t have this type of construct, so people unfamiliar with Python sometimes use a numerical counter instead:
for i in range(len(food)): print(food[i])
for piece in food: print(piece)
No comments:
Post a Comment