[PYTHON-CRYPTO] not pseudo code anymore!

Jeremy Hylton jeremy at alum.mit.edu
Fri Feb 16 23:43:24 CET 2001


A few comments on the PyCrypto code.  You've got a bunch of explicit
assignments to __doc__:

class SymmetricBase:
        __doc__ = """
            All symmetric algorithms must inherit from this base class.
        """

        __encryptKey = None
        __keySize = None

        def __init__(self, _encryptKey = None):
                __doc__ = """
                    _encryptKey = default encrypt key

                    1. check the key for validity and raise an error if it's not right
                    2. set the key to be member variable
                """

The __doc__ assignment are redundant for the class and incorrect for
the functions.  For the function, you're creating a local variable
named __doc__.  The correct way to write this is:

class SymmetricBase:
        """All symmetric algorithms must inherit from this base class."""

        __encryptKey = None
        __keySize = None

        def __init__(self, _encryptKey = None):
                """"_encryptKey = default encrypt key

                1. check the key for validity and raise an error if
                   it's not right
                2. set the key to be member variable
                """

Also, it is typically to limit lines to less than 80 characters.

Jeremy





More information about the python-crypto mailing list