unsupported operand type(s) for pow(): 'unicode', 'long', 'long': Pycrypto

Terry Reedy tjreedy at udel.edu
Fri Oct 7 19:50:22 EDT 2011


On 10/7/2011 2:54 PM, Kayode Odeyemi wrote:

> pow() needs params in non-unicode.

pow() need 2 or 3 numbers as args. The function that calls it must turn 
the (2.x) string into a number, either with hash() or its own hash 
function. That latter function probably want integers code in range(256).

"pow(x, y[, z])

     Return x to the power y; if z is present, return x to the power y, 
modulo z (computed more efficiently than pow(x, y) % z). The 
two-argument form pow(x, y) is equivalent to using the power operator: x**y.

     The arguments must have numeric types. With mixed operand types, 
the coercion rules for binary arithmetic operators apply. For int 
operands, the result has the same type as the operands (after coercion) 
unless the second argument is negative; in that case, all arguments are 
converted to float and a float result is delivered. For example, 10**2 
returns 100, but 10**-2 returns 0.01. If the second argument is 
negative, the third argument must be omitted. If z is present, x and y 
must be of integer types, and y must be non-negative.
"
-- 
Terry Jan Reedy




More information about the Python-list mailing list