Hi Bruce,

On Sat, May 17, 2014 at 12:29:54PM -0700, Bruce wrote:
>    I changed this to
> 
>    class Foo(Element):
>        def __init__(self, a):
>            self.data = a
>            Element.__init__(self, Foos)
> 
>    which seems a bit simpler as we still have Foo(1) without an extra
>    argument.

Notes:

- this should be `Foos()`, rather than Foos

- elements are more often than not constructed from their parent as:

  sage: F = Foos()
  sage: F(data)

  In this situation, both the parent and the data is passed to the
  constructor of the element class.

- In case your data structure consists of a single value, you can use
  ElementWrapper which does exactly the above __init__ for you
  together with some other goodies. For an example, see

        sage: S = Semigroups().example()
        sage: S??

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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to