realtimethrill
03-10-2009, 08:28 PM
Hi
I wanted to verify that number literals are objects in Python as they are in Ruby, so I typed in dir(1) at the console.
As I understand it, the + operator is actually calling __add__ behind the scenes.
If that's right, is there any particular reason why 1.__add__(2) doesn't work?
Apologies if this is a little basic!
I wanted to verify that number literals are objects in Python as they are in Ruby, so I typed in dir(1) at the console.
As I understand it, the + operator is actually calling __add__ behind the scenes.
If that's right, is there any particular reason why 1.__add__(2) doesn't work?
Apologies if this is a little basic!