diff --git a/doc/v2/faq.html b/doc/v2/faq.html index cc1df0b9..c21007ab 100644 --- a/doc/v2/faq.html +++ b/doc/v2/faq.html @@ -39,6 +39,8 @@ structure overflow
*= operator work?*= operator work?+Q: I have exported my class to python, with many overloaded operators. it +works fine for me except the*=operator. It always tells +me "can't multiply sequence with non int type". If I use +p1.__imul__(p2)instead ofp1 *= +p2, it successfully executes my code. What's wrong with +me? + +A: There's nothing wrong with you. This is a bug in Python +2.2. You can see the same effect in Pure Python (you can learn a lot +about what's happening in Boost.Python by playing with new-style +classes in Pure Python). + +
+>>> class X(object): +... def __imul__(self, x): +... print 'imul' +... +>>> x = X() +>>> x *= 1 ++ +To cure this problem, all you need to do is upgrade your Python to +version 2.2.1 or later. + +
Revised - 23 November, 2002 + 24 November, 2002