aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/advanced/cython/keycount.pyx
diff options
context:
space:
mode:
authorBen McGinnes <[email protected]>2018-09-17 22:32:30 +0000
committerBen McGinnes <[email protected]>2018-09-17 22:32:30 +0000
commit362caaf02f3a25b7e626572aa30b87771c2c8f4d (patch)
treec510bee6320c6d2696f85e60c47419c5be6f5099 /lang/python/examples/howto/advanced/cython/keycount.pyx
parentdocs: python bindings howto (diff)
downloadgpgme-362caaf02f3a25b7e626572aa30b87771c2c8f4d.tar.gz
gpgme-362caaf02f3a25b7e626572aa30b87771c2c8f4d.zip
docs: python bindings
* Updated the Cython example code slightly, along with the corresponding explanation.
Diffstat (limited to 'lang/python/examples/howto/advanced/cython/keycount.pyx')
-rwxr-xr-xlang/python/examples/howto/advanced/cython/keycount.pyx16
1 files changed, 13 insertions, 3 deletions
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))