====== Differences ====== This shows you the differences between two versions of the page.
python:about_python_iiii [2013-05-31 07:54] 127.0.0.1 external edit |
python:about_python_iiii [2013-05-31 21:34] (current) mithat |
||
---|---|---|---|
Line 176: | Line 176: | ||
== Mutators == | == Mutators == | ||
- | A mutator is a method that lets you write to an instance variable. Typically, they are named ''set_{variable-name}(self,{new-value})'' or ''set{variable-name}(self,{new-value})''. A mutator should check that the new-value makes sense. For example, we *might* define a ''set_count'' mutator as follows: | + | A mutator is a method that lets you write to an instance variable. Typically, they are named ''set_{variable-name}(self,{new-value})'' or ''set{variable-name}(self,{new-value})''. A mutator should check that the new-value makes sense. For example, we //might// define a ''set_count'' mutator as follows: |
<code python> | <code python> |