#4183: ?? can't always find the source for new style classes
----------------------------+-----------------------------------------------
Reporter: robertwb | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-3.1.3
Component: user interface | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by aginiewicz):
I didn't though about if for #2777, but based on
[http://psyco.sourceforge.net/psycoguide/metaclass.html], i.e. part "...
if {{{x}}} contains an instance of ... a new-style class, then
{{{type(x)}}} will be {{{x.__class__}}} instead of
{{{types.InstanceType}}}." - I think that test like:
{{{hasattr(arg, __class__) and type(arg) == arg.__class__}}}
could do the thing, maybe not best way but it works for example with
instances of {{{sage.rings.rational_field.RationalField}}}... no code to
attach yet (just in-place tests in console, it's 4:30 am here) - will try
to do some small patch soon
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4183#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---