On Wednesday, May 28, 2014 5:35:18 PM UTC+1, Nils Bruin wrote:
>
> Non-underscore attributes implement a mutable interface.
>>
> I wasn't aware of that convention. Is it documented somewhere, with 
> rationale?
>

Python provides @property and @foo.setter to make this convention work 
safely, so clearly its a common pattern.
 

>  - An accessor method allows a docstring to be attached, so it provides a 
> documentation hook. This is something we could find a solution to.
>

Docstrings can be attached to any attribute, no?

Python's primary mechanism for storing information on instances is via 
> attributes stored in the instance __dict__. Do we really want to dissuade 
> people from using the most straightforward storing method by default? The 
> "consenting adults" doctrine of Python suggests we shouldn't do that just 
> to enforce immutability. 


The underscore is a convention, nobody stops you from ignoring it. But at 
least you have been warned. There is a difference between "we are 
consenting adults" and having everything filled with glass shards.

-- 
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.

Reply via email to