On Thu, May 29, 2014 at 1:58 AM, Eric Gourgoulhon <egourgoul...@gmail.com> wrote: > Thanks for these clear explanations. > The case of IPython tab mechanism for getting documentation is very > convincing! > > Coming from the C++ world, I was used to have the attributes private, but > was not sure about the Python way of dealing with this (having read > different opinions about it). I did not underscored the "light" attributes, > like tensor_type, as noticed by Volker, to avoid the cost of calling some > method tensor_type() (in C++, thanks to the inline mechanism, there is no > cost issue for such access methods). But I am fully convinced now and I am > turning all the attributes of SageManifolds classes to private and introduce > the corresponding access methods, with their docstrings.
Please try to use a single underscore, e.g., self._tensor, instead of double underscore self.__tensor. The latter is the official Python way of making things (more) private. It has technical implications beyond just being a convention, in that it mangles things, e.g., self.__tensor works, but if T is a tensor, then T.__tensor does *not* work... The general convention we use these days is do NOT bother with the double underscore attributes, since it's just kind of annoying and we're consenting adults enough to just honor the convention that a single underscore means private. There is a lot of very old code in Sage that uses double underscore that we wrote during the first two years, but most newer code uses single underscore. -- William > > Eric. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William Stein Professor of Mathematics University of Washington http://wstein.org -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.