下边内容是关于python自定义pi函数的内容。


def pi():
    # Compute digits of Pi.
    # Algorithm due to LGLT Meertens.
    k, a, b, a1, b1 = 2, 4, 1, 12, 4
    while 1:
        while d == d1:
            yield d