[EMAIL PROTECTED] wrote:
> Every time I use dir(some module) I get a lot of attributes with double
> underscore, for example __add__. Ok, I thought __add__ must be a method
> which I can apply like this
> 
>>>>5.__add(8)
> 
> However Python responded
> SyntaxError: invalid syntax
> 
> I tried
> 
>>>>help(5.__add__)
> 
> but got
> SyntaxError: invalid syntax

Note that these SyntaxErrors are due to how Python parses floats:

 >>> 5.
5.0
 >>> 5.__add__(8)
Traceback (  File "<interactive input>", line 1
     5.__add__(8)
             ^
SyntaxError: invalid syntax
 >>> (5).__add__(8)
13

HTH,

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to