Unicode identifiers in Python?

Posted by viksit on Stack Overflow See other posts from Stack Overflow or by viksit
Published on 2010-04-15T22:52:31Z Indexed on 2010/04/15 22:53 UTC
Read the original article Hit count: 294

Filed under:
|
|

Hi all,

I want to build a Python function that calculates,

alt text

and would like to name my summation function S. In a similar fashion, would like to use ? for product, and so on. I was wondering if there was a way to name a python function in this fashion?

def S (..):
 ..
 ..

That is, does Python support unicode identifiers, and if so, could someone provide an example for it?

Thanks!


Original motivation for this was a piece of Clojure code I saw today that looks like,

(defn entropy [X]
      (* -1 (S [i X] (* (p i) (log (p i))))))

where S is a macro defined as,

(defmacro S
    ... )

and I thought that was pretty cool.

© Stack Overflow or respective owner

Related posts about python

Related posts about unicode