SimplicialComplex, missing facets method?

0 views
Skip to first unread message

davidp

unread,
May 26, 2009, 6:19:38 PM5/26/09
to sage-devel
Should there be a facets method? Should self.facets be self._facets?

sage: version()
'Sage Version 4.0.rc0, Release Date: 2009-05-21'
sage: s = SimplicialComplex(4, [[1,2], [1,4]])
sage: s.facets()
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)

/home/davidp/.sage/temp/poly/15731/
_home_davidp_math_sandpile_sage_sage_sandpile1_4_sandpile_sage_250.py
in <module>()

TypeError: 'list' object is not callable
sage: s.facets
[(1, 2), (1, 4)]

Dave

William Stein

unread,
May 26, 2009, 6:22:07 PM5/26/09
to sage-...@googlegroups.com
On Tue, May 26, 2009 at 3:19 PM, davidp <dav...@reed.edu> wrote:
>
> Should there be a facets method?  Should self.facets be self._facets?

Yes, I think that would be much more consistent with the rest of Sage.
That has the added bonus that s.facets? can document and give
examples of what facets are.

William

>
> sage: version()
> 'Sage Version 4.0.rc0, Release Date: 2009-05-21'
> sage: s = SimplicialComplex(4, [[1,2], [1,4]])
> sage: s.facets()
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /home/davidp/.sage/temp/poly/15731/
> _home_davidp_math_sandpile_sage_sage_sandpile1_4_sandpile_sage_250.py
> in <module>()
>
> TypeError: 'list' object is not callable
> sage: s.facets
> [(1, 2), (1, 4)]
>
> Dave
> >
>



--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

John H Palmieri

unread,
May 26, 2009, 7:25:12 PM5/26/09
to sage-devel
I would point out that there is a maximal_faces() method, which just
returns the set of facets. But if you want to change the 'facets'
attribute to '_facets' and then make 'facets' a synonym for
'maximal_faces', that's fine with me.

davidp

unread,
May 27, 2009, 2:37:38 PM5/27/09
to sage-devel
Thanks. I have switched to maximal_faces().

I had a simplicial complex, s, and typed "s." + TAB to see the
completions. I saw s.facets, before seeing s.maximal_faces, then was
confused by getting an error from s.facets(). It seems to be a
convention with Sage to keep attributes hidden, so I thought you might
want to know about this.

It is great to have simplicial complexes in Sage!

Thanks,
Dave

William Stein

unread,
May 27, 2009, 2:51:36 PM5/27/09
to sage-...@googlegroups.com
On Wed, May 27, 2009 at 11:37 AM, davidp <dav...@reed.edu> wrote:
>
> Thanks.  I have switched to maximal_faces().
>
> I had a simplicial complex, s, and typed "s." + TAB to see the
> completions.  I saw s.facets, before seeing s.maximal_faces, then was
> confused by getting an error from s.facets().  It seems to be a
> convention with Sage to keep attributes hidden, so I thought you might
> want to know about this.

Yes, it is. This convention has its pros and cons, and I'm not saying
it is the best. However, it is used systematically throughout several
hundred thousand lines of code, so for no other reason than
consistency, I think we should stick with it.

> It is great to have simplicial complexes in Sage!

Indeed!

>
> Thanks,
> Dave
>
> On May 26, 4:25 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:
>> On May 26, 3:19 pm, davidp <dav...@reed.edu> wrote:
>>
>>
>>
>> > Should there be a facets method?  Should self.facets be self._facets?
>>
>> > sage: version()
>> > 'Sage Version 4.0.rc0, Release Date: 2009-05-21'
>> > sage: s = SimplicialComplex(4, [[1,2], [1,4]])
>> > sage: s.facets()
>> > ---------------------------------------------------------------------------
>> > TypeError                                 Traceback (most recent call
>> > last)
>>
>> > /home/davidp/.sage/temp/poly/15731/
>> > _home_davidp_math_sandpile_sage_sage_sandpile1_4_sandpile_sage_250.py
>> > in <module>()
>>
>> > TypeError: 'list' object is not callable
>> > sage: s.facets
>> > [(1, 2), (1, 4)]
>>
>> > Dave
>>
>> I would point out that there is a maximal_faces() method, which just
>> returns the set of facets.  But if you want to change the 'facets'
>> attribute to '_facets' and then make 'facets' a synonym for
>> 'maximal_faces', that's fine with me.
> >
>



John H Palmieri

unread,
May 27, 2009, 6:34:16 PM5/27/09
to sage-devel


On May 27, 11:51 am, William Stein <wst...@gmail.com> wrote:
> On Wed, May 27, 2009 at 11:37 AM, davidp <dav...@reed.edu> wrote:
>
> > Thanks.  I have switched to maximal_faces().
>
> > I had a simplicial complex, s, and typed "s." + TAB to see the
> > completions.  I saw s.facets, before seeing s.maximal_faces, then was
> > confused by getting an error from s.facets().  It seems to be a
> > convention with Sage to keep attributes hidden, so I thought you might
> > want to know about this.
>
> Yes, it is.  This convention has its pros and cons, and I'm not saying
> it is the best.  However, it is used systematically throughout several
> hundred thousand lines of code, so for no other reason than
> consistency, I think we should stick with it.

Okay: http://trac.sagemath.org/sage_trac/ticket/6141

John
Reply all
Reply to author
Forward
0 new messages