Issue 1153: fix iter fragility
http://code.google.com/p/sympy/issues/detail?id=1153
New issue report by ondrej.certik:
Hi,
On Thu, Oct 09, 2008 at 02:19:35AM +0200, Ondrej Certik wrote:
> if hasattr(i, "__iter__"):
> RuntimeError: internal error: <RuntimeError object at 0xb03b60>
This occurs because our 'str' type has an '__iter__' special method. It
turns out that CPython's does not. I suppose we could remove our
__iter__, but I would rather suggest that sympy's code is fragile there:
as soon as someone realizes that in CPython it is possible to speed up
iteration over strings by creating a stringiterator type, then CPython
will grow a 'str.__iter__' as well, and the same infinite recursion will
occur in sympy...
A cleaner way to say "is x iterable?" would be to try to call iter(x)
and see if it raises TypeError or not.
A bientot,
Armin
-------------
Ondrej: I think this is easy to fix.
Issue attributes:
Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium EasyToFix
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---