#14912: UniqueRepresentation tutorial could use more love
--------------------------------------------+------------------------------
Reporter: darij | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.13
Component: documentation | Resolution:
Keywords: documentation, structure | Merged in:
Authors: Simon King | Reviewers: Darij Grinberg
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------------------+------------------------------
Comment (by darij):
Thanks for these clarifications!
Replying to [comment:25 SimonKing]:
> Replying to [comment:23 darij]:
> > I'd like more details on this:
> > {{{
> > 104 In addition, it is required that a unique factory instance is
provided
> > 105 with a name that allows to find its definition.
> > }}}
> > I assume this refers to the string parameter, e. g., in {{{F =
MyFactory("__main__.F")}}};
>
> Exactly.
>
> > but what kind of path should it contain if it is to be used somewhere
in a .py file rather than in a doctest? Just {{{F = MyFactory("F")}}} ?
>
> It is exactly as it is stated: A name is needed that allows to find the
factory's definition. Hence, if you put `F` into the global name space,
then `F = MyFactory("F")` is fine. If `F` is in a module `sage.foo.bar`,
then it is `F = MyFactory("sage.foo.bar.F")`.
>
> > What if it is defined inside a class?
>
> If the class is `sage.bar.foo.MyClass` and you want to use a factory for
the attribute `F` of this class, then I guess it is `F =
MyFactory("sage.bar.foo.MyClass.F"). Not tested, though.
Yeah, these things could very well be explained in the doc itself.
> > Not sure about this:
> > {{{
> > And
> > 408 with a factory, it is possible to create the resulting
instance by arguments
> > 409 that are different from the key used for caching.
> > }}}
> > Doesn't that also work with CachedRepresentation if one preprocesses
by declaring {{{__classcall_private__}}}?
>
> Yes. This could be clarified.
Kind-of; on the other hand, the preprocessing probably needs to be
idempotent for pickling to work well, so we have a serious restriction...
--
Ticket URL: <http://trac.sagemath.org/ticket/14912#comment:27>
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.