File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 2020	@$(SPHINXBUILD )  -M $@  " $( SOURCEDIR) " " $( BUILDDIR) " $(SPHINXOPTS )  $(O ) 
2121
2222autobuild :
23- 	sphinx-autobuild -p  9999 -b html " $( SOURCEDIR) " $(BUILDDIR ) /html
23+ 	sphinx-autobuild --port  9999 -b html " $( SOURCEDIR) " $(BUILDDIR ) /html
Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ Implementors are not required to implement methods with defaults:
137137       #  get_all(self) will automatically be copied from the interface default. 
138138
139139
140- interface methods.
140+ interface methods. This ensures that the default is valid for any
141+ implementation of the interface.
141142
142143In Python 3, :class: `default ` will show a warning if a default implementation
143144uses non-interface members of an object:
@@ -173,6 +174,28 @@ of ``get_all``:
173174   Consider changing ReadOnlyMapping.get_all or making these attributes part of ReadOnlyMapping. 
174175      class ReadOnlyMapping(interface.Interface): 
175176
177+ Default Properties
178+ ****************** 
179+ 
180+ :class: `default ` and :class: `property ` can be used together to create default properties:
181+ 
182+ .. code-block :: python 
183+ 
184+    class  ReadOnlyMappingWithSpecialKey (interface .Interface ): 
185+ 
186+        def  get (self key ): 
187+            pass  
188+ 
189+        @interface.default  
190+        @ property  
191+        def  special_key (self  
192+            return  self .get(' special_key'  
193+ 
194+ note ::
195+ 
196+    The order of decorators in the example above is important: ``@default `` must
197+    go above ``@property ``.
198+ 
176199Interface Subclassing
177200~~~~~~~~~~~~~~~~~~~~~ 
178201
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments