Unification Idea

Raymond Hettinger othello at javanet.com
Wed May 9 17:25:15 EDT 2001

Complex numbers define: .real, .imag, and .conjugate().
I think we ought to define them for floats, ints, and longs also.

arr = [ 2,10L, 5.1, 3+2j ]
map( lambda z: z.conjugate(), arr )            # This is what I would like to do

map( lambda z: type(z)==types.ComplexType and z.conjugate() or z, arr )   # vs.
what I have to do now

Raymond Hettinger
''' the more polymorphism, the better '''

More information about the Python-list mailing list