[Tutor] R: Re: Re: Re: Class learning

Alan Gauld alan.gauld at btinternet.com
Fri Jan 23 21:37:18 CET 2015

On 23/01/15 11:47, jarod_v6 at 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
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list