From 362caaf02f3a25b7e626572aa30b87771c2c8f4d Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Tue, 18 Sep 2018 08:32:30 +1000 Subject: docs: python bindings * Updated the Cython example code slightly, along with the corresponding explanation. --- lang/python/examples/howto/advanced/cython/keycount.pyx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lang/python/examples/howto/advanced/cython/keycount.pyx') diff --git a/lang/python/examples/howto/advanced/cython/keycount.pyx b/lang/python/examples/howto/advanced/cython/keycount.pyx index f0097db2..2aa636d5 100755 --- a/lang/python/examples/howto/advanced/cython/keycount.pyx +++ b/lang/python/examples/howto/advanced/cython/keycount.pyx @@ -1,3 +1,6 @@ +from __future__ import absolute_import + +import cython import gpg c = gpg.Context() @@ -10,7 +13,14 @@ secnum = len(seclist) publist = list(pubkeys) pubnum = len(publist) +if cython.compiled is True: + cc = "Powered by Cython compiled C code." +else: + cc = "Powered by Python." + print(""" -Number of secret keys: {0} -Number of public keys: {1} -""".format(secnum, pubnum)) + Number of secret keys: {0} + Number of public keys: {1} + + {2} +""".format(secnum, pubnum, cc)) -- cgit v1.2.3