[code.view]

[top] / python / PyMOTW / exceptions / exceptions_AttributeError_assignment.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     class MyClass(object):
         
         @property
         def attribute(self):
             return 'This is the attribute value'
     
     o = MyClass()
     print o.attribute
     o.attribute = 'New value'
     

[top] / python / PyMOTW / exceptions / exceptions_AttributeError_assignment.py

contact | logmethods.com