#14912: UniqueRepresentation tutorial could use more love
-------------------------------------+-------------------------------------
Reporter: darij | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.1
Component: documentation | Resolution:
Keywords: documentation, | Merged in:
structure | Reviewers: Darij Grinberg,
Authors: Simon King | Travis Scrimshaw
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: #14888 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by darij):
The patches apply fine on 6.0rc0, and the print no longer leaks.
But I've got another question on this paragraph:
{{{
.. NOTE::
For technical reasons, it is needed that ``__classcall__``
respectively
``__classcall_private__`` are "static methods", i.e., they are
callable
objects that do not bind to an instance or class. For example, a
:class:`~sage.misc.cachefunc.cached_function` can be used here,
because it
is callable, but does not bind to an instance or class, because it has
no
``__get__()`` method. A usual Python function, however, has a
``__get__()`` method and would thus under normal circumstances bind to
an
instance or class, and thus the instance or class would be passed to
the
function as the first argument. To prevent a callable object from
being
bound to the instance or class, one can prepend the ``@staticmethod``
decorator to the definition; see :class:`staticmethod`.
For more on Python's ``__get__()`` method, see:
http://docs.python.org/2/howto/descriptor.html
}}}
In `src/sage/groups/perm_gps.py`, I see:
{{{
@weak_cached_function
def __classcall__(cls, *args, **kwds):
"""
This makes sure that domain is a FiniteEnumeratedSet before it
gets passed
on to the __init__ method.
EXAMPLES::
sage: SymmetricGroup(['a','b']).domain() #indirect doctest
{'a', 'b'}
"""
domain = kwds.pop('domain', None)
if domain is not None:
if domain not in FiniteEnumeratedSets():
domain = FiniteEnumeratedSet(domain)
kwds['domain'] = domain
return super(PermutationGroup_unique, cls).__classcall__(cls,
*args, **kwds)
}}}
This is NOT decorated with `@staticmethod`. Isn't this contradictory to
the NOTE above?
--
Ticket URL: <http://trac.sagemath.org/ticket/14912#comment:67>
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/groups/opt_out.