> Actually in Python, dot-notation breaks down with this case: > 2.0.sin() ??? > I just noticed that. Perhaps one of the reasons smalltalk doesn't use > the dot. > > Greetings > > Christian
The way I look at it, Python ints and floats "out of the box" have a more limited repertoire than in Smalltalk apparently. >>> dir(2.0) ['__abs__', '__add__', '__class__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__ge__', '__getattribute__', '__getformat__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__int__', '__le__', '__long__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__nonzero__', '__pos__', '__pow__', '__radd__', '__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__setformat__', '__str__', '__sub__', '__truediv__'] >>> 2.0 .__add__(3.0) # normally 2.0 + 3.0 5.0 >>> 2.0 .__neg__() # normally -2.0 -2.0 Once we import math, then we get these external functions, which don't actually reach into the guts of the number type for an answer. The native types are knowledgeable, but not omniscient (likewise with user-defined). Kirby _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
