mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	+ Display property functions in the same order they're specified to
property() (get, set, del; not set, get, del).
+ Change "Data defined/inherited in ..." header lines to
  "Data and non-method functions defined/inherited in ...".  Things like
  the value of __class__, and __new__, and class vrbls like the i in
      class C:
          i = int
  show up in this section too.  I don't think it's worth a separate
  section to distinguish them from non-callable attrs, and there's no
  obvious reliable way to distinguish callable from non-callable attrs
  anyway.
			
			
This commit is contained in:
		
							parent
							
								
									c39553ad0d
								
							
						
					
					
						commit
						f33532cfef
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		
							
								
								
									
										14
									
								
								Lib/pydoc.py
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								Lib/pydoc.py
									
										
									
									
									
								
							| 
						 | 
					@ -646,8 +646,8 @@ def spillproperties(msg, attrs, predicate):
 | 
				
			||||||
                        doc = self.markup(value.__doc__, self.preformat,
 | 
					                        doc = self.markup(value.__doc__, self.preformat,
 | 
				
			||||||
                                          funcs, classes, mdict)
 | 
					                                          funcs, classes, mdict)
 | 
				
			||||||
                        push('<dd><tt>%s</tt></dd>\n' % doc)
 | 
					                        push('<dd><tt>%s</tt></dd>\n' % doc)
 | 
				
			||||||
                    for attr, tag in [("fset", " setter"),
 | 
					                    for attr, tag in [("fget", " getter"),
 | 
				
			||||||
                                      ("fget", " getter"),
 | 
					                                      ("fset", " setter"),
 | 
				
			||||||
                                      ("fdel", " deleter")]:
 | 
					                                      ("fdel", " deleter")]:
 | 
				
			||||||
                        func = getattr(value, attr)
 | 
					                        func = getattr(value, attr)
 | 
				
			||||||
                        if func is not None:
 | 
					                        if func is not None:
 | 
				
			||||||
| 
						 | 
					@ -713,7 +713,7 @@ def spilldata(msg, attrs, predicate):
 | 
				
			||||||
                          lambda t: t[1] == 'static method')
 | 
					                          lambda t: t[1] == 'static method')
 | 
				
			||||||
            attrs = spillproperties("Properties %s" % tag, attrs,
 | 
					            attrs = spillproperties("Properties %s" % tag, attrs,
 | 
				
			||||||
                                    lambda t: t[1] == 'property')
 | 
					                                    lambda t: t[1] == 'property')
 | 
				
			||||||
            attrs = spilldata("Data %s" % tag, attrs,
 | 
					            attrs = spilldata("Data and non-method functions %s" % tag, attrs,
 | 
				
			||||||
                              lambda t: t[1] == 'data')
 | 
					                              lambda t: t[1] == 'data')
 | 
				
			||||||
            assert attrs == []
 | 
					            assert attrs == []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1030,8 +1030,8 @@ def spillproperties(msg, attrs, predicate):
 | 
				
			||||||
                    if doc:
 | 
					                    if doc:
 | 
				
			||||||
                        push(self.indent(doc))
 | 
					                        push(self.indent(doc))
 | 
				
			||||||
                        need_blank_after_doc = 1
 | 
					                        need_blank_after_doc = 1
 | 
				
			||||||
                    for attr, tag in [("fset", " setter"),
 | 
					                    for attr, tag in [("fget", " getter"),
 | 
				
			||||||
                                      ("fget", " getter"),
 | 
					                                      ("fset", " setter"),
 | 
				
			||||||
                                      ("fdel", " deleter")]:
 | 
					                                      ("fdel", " deleter")]:
 | 
				
			||||||
                        func = getattr(value, attr)
 | 
					                        func = getattr(value, attr)
 | 
				
			||||||
                        if func is not None:
 | 
					                        if func is not None:
 | 
				
			||||||
| 
						 | 
					@ -1081,8 +1081,8 @@ def spilldata(msg, attrs, predicate):
 | 
				
			||||||
                          lambda t: t[1] == 'static method')
 | 
					                          lambda t: t[1] == 'static method')
 | 
				
			||||||
            attrs = spillproperties("Properties %s:\n" % tag, attrs,
 | 
					            attrs = spillproperties("Properties %s:\n" % tag, attrs,
 | 
				
			||||||
                                    lambda t: t[1] == 'property')
 | 
					                                    lambda t: t[1] == 'property')
 | 
				
			||||||
            attrs = spilldata("Data %s:\n" % tag, attrs,
 | 
					            attrs = spilldata("Data and non-method functions %s:\n" % tag,
 | 
				
			||||||
                              lambda t: t[1] == 'data')
 | 
					                              attrs, lambda t: t[1] == 'data')
 | 
				
			||||||
            assert attrs == []
 | 
					            assert attrs == []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Split off the attributes inherited from the next class (note
 | 
					            # Split off the attributes inherited from the next class (note
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue