Changes between Initial Version and Version 1 of Ticket #10467


Ignore:
Timestamp:
12/12/10 11:35:54 (12 years ago)
Author:
SimonKing
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10467

    • Property Status changed from new to needs_review
  • Ticket #10467 – Description

    initial v1  
    11By a private attribute, I mean an attribute whose name starts with two underscores and does not end with an underscore. Such an attribute is used, e.g., in the default `__repr__` method of Sage objects.
    22
    3 It should be reasonable to assume that private attributes belong to a particular instance, not to its class or its category. In particular, if `P` is a parent/element, then `P.__foo` is either defined for the instance `P` or will not be available from `P.category().parent_class` resp. from `P.category().element_class`.
     3It should be reasonable to assume that private attributes belong to a particular instance, not to its class or its category; after all, they are subject to Python's name mangling.
     4
     5In particular, if `P` is a parent/element, then `P.__foo` is either defined for the instance `P` or will not be available from `P.category().parent_class` resp. from `P.category().element_class`.
    46
    57It turns out that this assumption holds thorought Sage: When one lets the `__getattr__` methods of Parent/Element immediately raise an `AttributeError` when a private attribute is requested, then all doc tests still pass.