Strange behaviour: subclass of int returns 3 when constructed with long

Gerrit Holl gerrit at nl.linux.org
Sun Feb 9 09:48:22 EST 2003


Hi,

  0 >>> class A(int): pass
  0 ...
  1 >>> int(sys.maxint)
2147483647
  2 >>> A(sys.maxint)
2147483647
  3 >>> int(sys.maxint+1)
2147483648L
  4 >>> A(sys.maxint+1)
3
  5 >>> A(sys.maxint+42)
3
  6 >>> int(A(sys.maxint+1))
3

how can this behaviour be explained? Shouldn't A behave identical to int?

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list