Hi Mark!

On Thu, May 30, 2013 at 08:15:22PM -0700, Mark Shimozono wrote:
>    I am trying to make a parent with multiple realizations. I looked
>    at the tutorial
> 
>    sage: C = Sets().WithRealizations().example()
>    sage: C??
> 
>    The calling and parameter passing mechanisms are escaping me here.
> 
>    Inside the scope of
> 
>    class SubsetAlgebra
> 
>    there is the
> 
>    class Fundamental
> 
>    with initialization
> 
>  def __init__(self, A):
> 
>    It is invoked by
>    B = A.Fundamental()
>    where A is an instance of the subset algebra.
> 
>    Normally this only passes one parameter.
>    How does the __init__ method receive the parameter A?

The magic is in:

        class Fundamental(..., BindableClass):
            ...

It makes Fundamental behave like a method in that A.Fundamental() is
equivalent to Fundamental(A). This saves you from having to write a
wrapper method doing just that for each of your realizations.

>    Also, how does
> 
>    B.realization_of()
> 
>    know what it should return?

In the __init__ of Fundamental, B's category is set to ``A.Bases()``,
and B.realization_of() gets the information from there.

>    Finally, if I were to write an element class for the Fundamental basis,
>    how can I inform the parent class about its element class?
>    I had trouble with the Element =
>    declaration.

This should work as usual. I guess I would need a sample of code to
analyze what went wrong.

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to