Math Symbol as Function Name in Python 3

Wee, python 3 now supports Unicode in variable and function names! Example:

# Python 3

def ƒ(n):
    return n+1

α = 4
print(ƒ(α)) # prints 5

In python 2, you can't do that, also, you'll have to put # -*- coding: utf-8 -*- in the first line if your script if it contains any unicode string.

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?