Holy Uni    de

AR,
Pražské Pyvo
Nov, 2018

Who am I?

Alex Rembish. Siberian. Traveller. Team leader.
DevOps supporter. Python exterminator.

Who am I?

What's going on?

1st Grade Math
Lightning Talk

What's going on?

1st Grade Math
Lightning Talk

Quiz

Rules

  • Slide (check title)
  • Raise a hand
  • Answer
  • 5 secs discussion - rly?!

Question #1: Python 2.7

#! /usr/bin/env python2

prádelna = 2
á = 1

print(prádelna - á)  # = ?

Answer #1: Oops 2.7

prádelna = 2
  ^
SyntaxError: invalid syntax

Next code will not work as well:

# coding=utf8
import sys
reload(sys)
sys.setdefaultencoding("utf8")

Q2: KISS principle

#! /usr/bin/env python3

A = 1
A = 2

print(A - A)  # = ?

A2: You didn't even try

#! /usr/bin/env python3

A = 1
A = 2

print(A - A)  # = 0

Q3: Are you serious?

#! /usr/bin/env python3

Α = 1
A = 2

print(Α - A)  # = ?

A3: What the Hell?!

#! /usr/bin/env python3

Α = 1  # GREEK CAPITAL LETTER ALPHA
A = 2  # LATIN CAPITAL LETTER A

print(Α - A)  # = -1

Q4: Bamboozling!

#! /usr/bin/env python3

A = 1
A = 2

print(A - A)  # = ?

A4: Getting bamboozled!

#! /usr/bin/env python3

A = 1  # FULLWIDTH LATIN CAPITAL LETTER A
A = 2  # LATIN CAPITAL LETTER A

print(A - A)  # = 0
#! /usr/bin/env python3

AAAA = 1
AAAA = 2
print(globals())
# => {..., 'AAAA': 2}

Q5: Why not?

#! /usr/bin/env python3

print(not(True))  # = ?

Q5.1: Calm down

#! /usr/bin/env python3

print(not(True))  # = False

def nοt(x):
    return x

print(nοt(True))  # = ?

A5: Calm down, I said

#! /usr/bin/env python3

print(not(True))  # = False

def nοt(x):
    return x

print(nοt(True))  # = True

A5.1: Don't do it

#! /usr/bin/env python3

print(not(True))  # = False

def nοt(x):  # Greek Capital Letter Omicron
    return x

print(nοt(True))  # = True
    def not(x):
          ^
SyntaxError: invalid syntax

Q6: Holy Cow!

#! /usr/bin/env python3

🐮 = 1
🍖 = 2

print(🐮 - 🍖)  # = ?

A6: Unholy cow

#! /usr/bin/env python3

🐮 = 1
🍖 = 2

print(🐮 - 🍖)
    🐮 = 1
    ^
SyntaxError: invalid character in identifier

A6.1: 

$ pip install emoji-encoding
# filename: emoji.py

#! /usr/bin/env python
# coding: emoji

🐮 = 1
🍖 = 2

print(🐮 - 🍖)
from emojiencoding import bootstrap
import emoji  # = -1

Don't try it at work!

#! /usr/bin/env python3
from math import pi, sin
π = pi
α = π / 2.
print(sin(α))  # = 1.0

But

Next stop

Next stop

Send me a tweet:

Join my team:

Holy Uni-cow-de

By Alex Rembish

Holy Uni-cow-de

  • 1,340