Rot and polyalphabetic ciphers in Python 2.7 I'm writing a "crypto library" and gradually adding algortihms. Now it's just ancient cryptography, but I'm going to expand the library.
It doesn't depend on any external libraries.

class Crypto():
    def __init__(self, rotInt=3, letters=list("abcdefghijklmnopqrstuvwxyz")):
        self.letters = letters
        self.length = len(self.letters)
        self.rotInt = rotInt
    def rot(self, string, rotInt, letters, length): # To decrypt, use a negative number
        result = []
        for letter in string:
            if letter == " ": # Skip spaces
                result.append(" ")
            else:
                letterIndex = letters.index(letter)
                resultIndex = letterIndex + rotInt
                resultIndex = resultIndex % length-1
                result.append(letters[resultIndex])
        return "".join(result) # Return result as a string
    def getRotArr(self, string, negative=False): # Negative is for decryption
        result = []
        for char in string:
            if negative:
                result.append(0-(self.letters.index(char)+1))
            else:
                result.append(self.letters.index(char)+1)
        return result
    def polyalphabetic(self, string, rotArr, letters, length):
        result = []
        rotArrIndex = 0
        for letter in string:
            if letter == " ": # Skip spaces
                result.append(" ")
            else: # Spaces would mess up rotArrIndex
                if rotArrIndex &gt; len(rotArr)-1: # Repeat when end of rotArr is reached
                    rotArrIndex = 0
                rotInt = rotArr[rotArrIndex]
                letterIndex = letters.index(letter)
                resultIndex = letterIndex + rotInt
                resultIndex = resultIndex % length
                result.append(letters[resultIndex])
                rotArrIndex += 1
        return "".join(result) # Return result as a string
rotInt, letters, length are defined in class. Use it.

Instead of for loop use map. 

def rot(self, string, letters=None, rotInt=None):
    if letters is None:
        letters = self.letters
    length = len(letters)
    if rotInt is None:
        rotInt = self.rotInt
    return ''.join(map(lambda letter: letter in letters and letters[(letters.index(letter) + rotInt) % length] or letter, string))


and or

It's like bool ? a : b in C / C++. It's equivalent to:

if bool:
    return a
else:
    return b