On 23/01/15 11:47, jarod...@libero.it wrote:
Thanks so much for clear explanation!!! So in this way work . In [38]: Test().x.__name__ Out[38]: 'x' The decoratory proprerty dosen't help to create the class in fast way.. When it is advisable use @property?
Very rarely, and mainly when you need to access a number of attributes some of which are pure data and others are derived via a method. You can make the methods look like data by making them properties.
In 18 years of using python I've used @property about 3 or 4 times in real projects.
It is used a lot in Delphi (Object Pascal) and some similar languages but it's not often needed in Python. -- 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