Python 3.6+

Python 3.6+ is a new Lisp (without uniform prefix notation, macros and the code-is-data principle) and a new Smalltalk (without uniform message-passing-only syntax). It is well-designed around proper principles and highly polished by a devoted community. It has a culture, which improves the language and itself (a mutually recursive process).

Optional type annotations in Python 3.6+ and external type-checkers, such as mypy or pyre-check could make development process even more pleasant.

attention to details

Python is famous for attention to detail and doing everything just right (so does Go)

collections, iterators and generators (notice that everything is a class - an ADT):

>>> type("")
<class 'str'>
>>> type([])
<class 'list'>
>>> type(())
<class 'tuple'>
>>> type({})
<class 'dict'>


type({x for x in ""})
<class 'set'>
>>> type([x for x in []])
<class 'list'>
type({x: x**2 for x in ()})
<class 'dict'>


>>> type(iter([x for x in []]))
<class 'list_iterator'>
>>> type(reversed([]))
<class 'list_reverseiterator'>
>>> type(enumerate({}))
<class 'enumerate'>

generator comprehensions

>>> type((x for x in ""))
<class 'generator'>


>>> type((x for x in "" if x > 0))
<class 'generator'>

This will print nothing - the branch will never be executed

if None in []:
for a in []:
    print(type(a), a)

So, this code is wrong - explicit check for is not None is redundant

for user in db.query(User).filter_by( == name):
    if user is not None:
        if email in user.addresses:

The proper snippet is

for user in db.query(User).filter_by( == name):
    if email in user.addresses:

and this is beautiful code

It is the opposite of Languages/PHP

Last modified 13 months ago Last modified on Nov 19, 2018, 4:48:48 AM
Note: See TracWiki for help on using the wiki.