Hi Maarten,
On 27 Aug., 22:07, Maarten Derickx <[email protected]>
wrote:
> sage: L
> <type 'sage.structure.sage_object.SageObject'>
> sage: SageObject
> <type 'sage.structure.sage_object.SageObject'>
>
> Note that L is actually an instance of SageObject and not SageObject itself.
> Is this by design or a bug? I say it should change since it will make
> debugging very confusing!
That's to say, you want that SageObject behaves like any odd class in
Python, namely
>>> class Foo: pass
...
>>> Foo
<class __main__.Foo at 0x7f1e04c9e5f0>
>>> Foo()
<__main__.Foo instance at 0x7f1e04cb0248>
or like in Cython, namely
sage: cython("cdef class Foo: pass")
sage: Foo
<type '_mnt_local_king__sage_temp_mpc622_31046_tmp_0_spyx_0.Foo'>
sage: Foo()
<_mnt_local_king__sage_temp_mpc622_31046_tmp_0_spyx_0.Foo object at
0x7fee7fbf4740>
Why not?
That said, classes derived from SageObject are, of course, supposed to
provide a *single* underscore method _repr_ defining a custom string
representation. So, I am surprised that your post sounds as if the
confusion occurred in practice.
Cheers,
Simon
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org