Thank you for your answers. I was actually aware of hidden methods being
accessible from inside the class, but I somehow gave a bad example... I
note the advices that
1. Having to do manual mangling probably reveals some bad
structuration, and
2. Instead of do manual mangling, one can us
On 2015-06-04 18:23, Bruno Grenet wrote:
Thus if I implement a method `number_of_terms` in the class
`Polynomial_generic_sparse`, I am tempted to implement the third
solution.
Since this is a class where the attribute is defined, you don't need to
mangle anything.
Otherwise, I would say that m
On Thu, Jun 4, 2015 at 11:16 AM, David Roe wrote:
> I would say that it's fine, especially in a subclass.
> David
>
And I would say it's not fine. If you have to explicitly de-mangle an
attribute name, then the overall code is structured badly. The whole
point of __ attributes in Python is to h
I would say that it's fine, especially in a subclass.
David
On Thu, Jun 4, 2015 at 9:23 AM, Bruno Grenet wrote:
> Dear all,
>
> Many classes in SageMath (most of them? all of them? I don't know...) have
> their attributes hidden by a leading `__`. Yet in Python hidden attributes
> are never re
Dear all,
Many classes in SageMath (most of them? all of them? I don't know...)
have their attributes hidden by a leading `__`. Yet in Python hidden
attributes are never really hidden, since it is possible to access the
attribute `__hidden` of the class `MyClass` as `_MyClass__hidden`.
What