[Python-checkins] CVS: python/nondist/peps pep-0227.txt,1.3,1.4

Guido van Rossum python-dev@python.org
Thu, 14 Dec 2000 06:40:48 -0800


Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9925

Modified Files:
	pep-0227.txt 
Log Message:
Indent the examples to make sure the HTML looks right.


Index: pep-0227.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0227.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** pep-0227.txt	2000/12/14 04:53:15	1.3
--- pep-0227.txt	2000/12/14 14:40:45	1.4
***************
*** 159,199 ****
      A few examples are included to illustrate the way the rules work.
  
! >>> def make_fact():
! ...     def fact(n):
! ...         if n == 1:
! ...             return 1L
! ...         else:
! ...             return n * fact(n - 1)
! ...     return fact
! >>> fact = make_fact()
! >>> fact(7)    
! 5040L
  
! >>> def make_adder(base):
! ...     def adder(x):
! ...         return base + x
! ...     return adder
! >>> add5 = make_adder(5)
! >>> add5(6)
! 11
  
! >>> def make_wrapper(obj):
! ...     class Wrapper:
! ...         def __getattr__(self, attr):
! ...             if attr[0] != '_':
! ...                 return getattr(obj, attr)
! ...             else:
! ...                 raise AttributeError, attr
! ...     return Wrapper()
! >>> class Test:
! ...     public = 2
! ...     _private = 3
! >>> w = make_wrapper(Test())
! >>> w.public
! 2
! >>> w._private
! Traceback (most recent call last):
!   File "<stdin>", line 1, in ?
! AttributeError: _private
  
      An example from Tim Peters of the potential pitfalls of nested scopes
--- 159,199 ----
      A few examples are included to illustrate the way the rules work.
  
!     >>> def make_fact():
!     ...     def fact(n):
!     ...         if n == 1:
!     ...             return 1L
!     ...         else:
!     ...             return n * fact(n - 1)
!     ...     return fact
!     >>> fact = make_fact()
!     >>> fact(7)    
!     5040L
  
!     >>> def make_adder(base):
!     ...     def adder(x):
!     ...         return base + x
!     ...     return adder
!     >>> add5 = make_adder(5)
!     >>> add5(6)
!     11
  
!     >>> def make_wrapper(obj):
!     ...     class Wrapper:
!     ...         def __getattr__(self, attr):
!     ...             if attr[0] != '_':
!     ...                 return getattr(obj, attr)
!     ...             else:
!     ...                 raise AttributeError, attr
!     ...     return Wrapper()
!     >>> class Test:
!     ...     public = 2
!     ...     _private = 3
!     >>> w = make_wrapper(Test())
!     >>> w.public
!     2
!     >>> w._private
!     Traceback (most recent call last):
!       File "<stdin>", line 1, in ?
!     AttributeError: _private
  
      An example from Tim Peters of the potential pitfalls of nested scopes