Jim Byrnes <jf_byr...@comcast.net> Wrote in message: > I am reading Practical Programming - An Introduction to Computer Science > Using Python 3. They give this example: > > >>> abs(-3) > 3 > > >>> -3 .__abs__() > 3 >
Ben is right, dunder methods don't belong in introductory texts. And they seldom should be called directly; they're there for folks who are defining new classes that want to mimic behavior of builtins. But he didn't show you the simplest fix: (-3).__abs__() -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor