[Tutor] R: Re: Re: Re: Class learning
Alan Gauld
alan.gauld at btinternet.com
Sat Jan 24 01:47:02 CET 2015
On 24/01/15 00:37, Cameron Simpson wrote:
> By contrast, I use it a far bit (though still far less than non-property
> methods). Generally for derived properties which are:
>
> - cheap to compute i.e. O(1)
>
> - which I want to abstract
>
> - usually represent some property which is stable, such as a size
>
> - occasionally (much more rarely) a property which is not stable,
But why a property rather than a simple method?
Why is
k = url.key
better than
k = url.key()
for meeting those criteria?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list