#19125: DeprecatedMethod wrapping is broken
-------------------------+-------------------------------------------------
Reporter: | Owner:
nbruin | Status: needs_review
Type: | Milestone: sage-6.9
defect | Resolution:
Priority: | Merged in:
blocker | Reviewers: Vincent Delecroix
Component: misc | Work issues:
Keywords: | Commit:
Authors: Nils | b37033ac0dbe763f7b7e9b3ab337d6adff42cb5b
Bruin | Stopgaps:
Report Upstream: N/A |
Branch: |
public/19125 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by nbruin):
I don't agree with the `self.unbound or self` statement. We really want to
test against a sentinel here, not whether the object `f.unbound` is bound
to considers itself false. One can make "false" callable objects:
{{{
class A:
def __call__(self):
return "me"
def __nonzero__(self):
return false
}}}
{{{
sage: a=A()
sage: a or 10
10
sage: a()
'me'
}}}
We shouldn't question or depend on the sanity of the code we're wrapping.
It's deprecated code, after all, so it probably has something wrong with
it. (with a little work you could extend the class A upstairs into
something whose objects can be used as bindable methods: just provide the
appropriate `__get__`).
If you really prefer a one-liner here, I'd be OK with
{{{
search_for = self.unbound if (self.unbound is None) else self
}}}
The other changes are fine with me.
--
Ticket URL: <http://trac.sagemath.org/ticket/19125#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.