fixedpoint.py vs Python 2.1

Tim Peters tim.one at comcast.net
Thu Apr 17 11:36:19 EDT 2003


[Robin Becker]
> I'm having a bit of difficulty with the fixedpoint module in Python 2.1.
>
> I get the following error
>
> Python 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> >>> from fixedpoint import FixedPoint as fp
> >>> fp(fp(.175,3)*fp(22,2),2)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "fixedpoint.py", line 368, in __mul__
>     return _mkFP(self._roundquotient(n1 * n2, _tento(p)), p, type(self))
>   File "fixedpoint.py", line 497, in _mkFP
>     f = FixedPoint()
> TypeError: object of type 'type' is not callable
> >>>
>
> is there some reason for passing type(self) around rather than
> self.__class__ etc.

This must have come from the SourceForge version of FixedPoint, so ask
there.

Find a version of the code that predates the SF one, and it won't have this
problem (it didn't originally use type(self) or self.__class__).

I don't know whether the SF folks intended to support Pythons earlier than
2.2.






More information about the Python-list mailing list