Proposal of an API to deal with fingerprints on Python

Chris Angelico rosuav at gmail.com
Thu May 29 22:44:34 EDT 2014


On Fri, May 30, 2014 at 7:21 AM, Pedro Izecksohn
<izecksohn at yahoo.com.dmarc.invalid> wrote:
>   Today I wrote the following API. It was not implemented on C yet. Do you have any comment? Could you help me to implement it?
>
> http://www.izecksohn.com/pedro/python/fingerprint/fingerprint.001.py

If that's a proof-of-concept for just the function names and things,
then what I'd say is: Follow PEP 8, especially if (as your license
comment suggests) you're hoping for it to be included in the Python
standard library. Notably, use underscore_separated_names rather than
mixedCase for function names.

If that's meant to be actual usable (if stubby) code, then PEP 8 is
even more important; for instance, "if (None == fpdev):" should be "if
fpdev is None:". Also, your bare excepts are nasty code smell.

My recommendation: Look into Cython. You're basically wrapping a C
library, so you should be able to let Cython do the heavy lifting, and
then maybe just add a few convenience functions in pure Python. There
won't be much work, that way!

Regarding licensing, by the way, I would advise decoupling yourself
from the CPython standard library, which has a bit of a mess of
licensing and ownership due to its long history. Pick one of the
well-known open source licenses, like MIT, GPL2/GPL3, or MPL, and use
that. Post your code on some place like github or bitbucket, link to
it from PyPI, and let your project stand alone as a third-party
installable package - if it's good, people will use it, and they can
find it using pip or equivalent.

ChrisA



More information about the Python-list mailing list