Object oriented programming uses these terms for similar concepts:
attribute: variable associated with an object (apparently also called field)
method: function associated with an object
property: calculated like a method without arguments, but accessed like an attribute
<code>class Person(object):
def __init__(self, name, birthday):
self.name = name
self.birthday = birthday
def age(self, day):
return day - self.birthday
@property
def astrological_sign(self):
return some_magic(self.birthday)
</code>
<code>class Person(object):
def __init__(self, name, birthday):
self.name = name
self.birthday = birthday
def age(self, day):
return day - self.birthday
@property
def astrological_sign(self):
return some_magic(self.birthday)
</code>
class Person(object):
def __init__(self, name, birthday):
self.name = name
self.birthday = birthday
def age(self, day):
return day - self.birthday
@property
def astrological_sign(self):
return some_magic(self.birthday)
The code above illustrates their use in a Python class.
Is there any way to say “attribute, method or property” in one word?
(If am rather annoyed, that they took the word property for something specific.
They should have left it generic, and used metribute instead.)