#18158: `__getitem__` for libGap_Element
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.6
Component: interfaces | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/18158 | ee6506d15b2bbb976c738d6b804edf864a6ab24e
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by {'newvalue': u'Vincent Delecroix', 'oldvalue': ''}):
* status: new => needs_review
* author: => Vincent Delecroix
* priority: critical => major
* branch: => u/vdelecroix/18158
* commit: => ee6506d15b2bbb976c738d6b804edf864a6ab24e
Old description:
> There are two issue with `__getitem__` on gap vs libgap elements:
> - gap indices start with `1`. This is respected with the gap interface
> but not with the libgap interface
> - most libgap elements lacks a `__getitem__`
>
> Compare:
> {{{
> sage: irr = libgap.Irr(libgap.CharacterTable(S))
> sage: irr[0]
> Character( CharacterTable( Sym( [ 1 .. 10 ] ) ), [ 1, -1, 1, -1, 1, -1,
> 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1,
> -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1 ] )
> sage: irr[0][0]
> Traceback (most recent call last):
> ...
> TypeError: 'sage.libs.gap.element.GapElement' object has no attribute
> '__getitem__'
> }}}
> with
> {{{
> sage: irr = gap.Irr(gap.CharacterTable(S))
> sage: irr[1]
> Character( CharacterTable( SymmetricGroup( [ 1 .. 10 ] ) ),
> [ 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1,
> -1, 1,
> -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1 ]
> )
> sage: irr[1][1]
> 1
> }}}
New description:
Some objects in GAP are not list but does support indexation
{{{
gap> S := SymmetricGroup(5);;
gap> irr := Irr(S)[3];;
gap> irr[1];
5
}}}
We provide in this ticket a generic `__getitem__` on `GapElement`.
--
Comment:
I guess this is far from being optimal but it at least very useful to me!
Vincent
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=ee6506d15b2bbb976c738d6b804edf864a6ab24e
ee6506d]||{{{Trac 18158: generic __getitem__ for libgap object}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/18158#comment:7>
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/d/optout.