Properties vs. get/set-methods

Mark McEahern marklists at mceahern.com
Fri Aug 23 16:40:13 CEST 2002


> Exactly. In the above sample what is gained by:
> 
> >>> x = foo()
> >>> x.val = 'bar'
> >>> x.val
> 'bar'
> 
> as opposed to:
> 
> >>> x.setVal('bar2')
> >>> x.getVal()
> 'bar2'

Consider it stylistic.

Cheers,

// mark
-





More information about the Python-list mailing list