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
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor