Hello,

On Mon, Sep 8, 2008 at 3:43 PM, Bill Page <[EMAIL PROTECTED]> wrote:
>
> So far everything is looking good to me in your patch. :-) I wonder if
> there is still time to get it into the next release of Sage?

Yes, it should get in.

> I have a question about the best way to add some new functionality to
> the axiom interface. Maybe this is an interface design issue or maybe
> it is just a Python question ...
>
> In Sage we can call the Axiom 'guess' function (written by Martin
> Rubey) to guess expressions for integer sequences. Eg.
>
> sage: g=axiom('guess [1,3,5,7,9]')

(I would write this as axiom.guess([1,3,5,7,9]) -- while less
efficient, I think it's cleaner.)

> and I get the result I hoped for! :-) But when I write:
>
> sage: g[1].order
> <built-in method order of AxiomElement object at 0x2b30ac8cdaa0>
>
> I do not get the expected result of 0. :-(
>
> How can I persuade Sage to treat '.order' as a call to __getattr__ ?

__getattr__ only gets called on AttributeErrors so since there is the
inherited 'order' present, it doesn't get called.  There isn't really
a way around this.


> As far as I understand, 'order' is a method inherited via
> ExpectElement from RingElement. I do not understand why ExpectElement
> subclasses RingElement. Why Ring?

Basically because RingElements conveniently had the necessary hooks
needed for the coercion system, etc. to do the right thing when you do
something like:

sage: axiom(2) + 2.5
4.5
sage: _.type()
Float

> Anyway, in general I am looking for
> a convenient and natural way to access elements of Axiom type Record
> and Union.

You could still allow for the dot access like you had before with this
inheritance caveat.  Another option is to treat Records like
dictionaries in Python so you'd make modifications to __getitem__ to
allow for things like g['order'] or g['function'].

--Mike

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to