On Thu, Dec 06, 2012 at 01:13:09AM +0000, Dima Pasechnik wrote:
> > Here's a related question: suppose I have an object G in sage. Is there a 
> > "correct" way to ask G if is it a CombinatorialFreeModule? I can check for
> >
> > if hasattr(G,'_basis_keys'): ...
> >
> > but I would have thought that there was a better way to do this...
> isinstance?
> 
> 
> sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
> sage: isinstance(F,CombinatorialFreeModule)
> True
> sage: isinstance([],CombinatorialFreeModule)
> False

Depending on what you want to test exactly, you might or not want to do

    sage: F in ModulesWithBasis

which will eventually include QQ^3, QQ['x'], ...

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 post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to