473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What is attribute stands for in Python?

440 256MB
I saw some of the Books ,they are referring to attributes.Correct me if my understanding is correct about the attributes.

In classes we have data variables and methods.So clubbing together they are called as attributes.

Thanks
PSB
Mar 15 '07 #1
8 1838
bvdet
2,851 Expert Mod 2GB
I saw some of the Books ,they are referring to attributes.Correct me if my understanding is correct about the attributes.

In classes we have data variables and methods.So clubbing together they are called as attributes.

Thanks
PSB
An 'attribute' is a property or value associated with an object. A method performs an operation of some sort on an object. Both are accessed with the dot operator.
Mar 15 '07 #2
psbasha
440 256MB
Thanks for the reply.

So attribute is a member variable of a class.

-PSB
Mar 15 '07 #3
bartonc
6,596 Expert 4TB
Thanks for the reply.

So attribute is a member variable of a class.

-PSB
Sometimes called "members", as a group, methods, class variables and instance variables are all attributes of objects:

>>> class aClass:
... a = 1
... def aFunc():
... pass
...
>>> inst = aClass() # create and instance
# Check to see if the instance has attributes
>>> hasattr(inst, 'a')
True
>>> hasattr(inst, 'aFunc')
True
>>>
Mar 15 '07 #4
bvdet
2,851 Expert Mod 2GB
Sometimes called "members", as a group, methods, class variables and instance variables are all attributes of objects:

>>> class aClass:
... a = 1
... def aFunc():
... pass
...
>>> inst = aClass() # create and instance
# Check to see if the instance has attributes
>>> hasattr(inst, 'a')
True
>>> hasattr(inst, 'aFunc')
True
>>>
I agree that methods are commonly referred to as attributes (data and method attributes). However, by definition they are different.
Mar 15 '07 #5
psbasha
440 256MB
So Class attributes means -> Data Memebers ( Variables and Methods in a class).Similar to C++ terminology or OOPs
Mar 15 '07 #6
bartonc
6,596 Expert 4TB
So Class attributes means -> Data Memebers ( Variables and Methods in a class).Similar to C++ terminology or OOPs
Object Oriented terminology predates C++. I borrow my use of the terms from books on OO Analysis and OO Design.
Mar 16 '07 #7
psbasha
440 256MB
Hi,

Could you please suggest me the Books on OOAD.

Thanks
-PSB
Mar 16 '07 #8
bartonc
6,596 Expert 4TB
Hi,

Could you please suggest me the Books on OOAD.

Thanks
-PSB
Here is a PDF that looks good. Here is a web site with that name. Here you will find a cheap copy of a book that was very useful to me. Just google "Object Oriented Analysis" for more resources.
Mar 16 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
8
by: Roy Smith | last post by:
For the past 6-8 months, I've spent most of my time writing C++ and a little bit of Java. Both of these languages support and encourage the use of private data and explicit accessor functions,...
28
by: David MacQuigg | last post by:
I'm concerned that with all the focus on obj$func binding, &closures, and other not-so-pretty details of Prothon, that we are missing what is really good - the simplification of classes. There are...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
112
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please,...
5
by: Neil Norfolk | last post by:
I am using C# in Visual Studio 2003. I would like to serialize a class that contains, amongst other things, public delegate void DocumentsPreferencesChange(object env, Documents e); public event...
8
by: Neil.Jin | last post by:
>>> class A: .... i = 1 .... >>> a = A() >>> A.i 1 >>> a.i 1 >>> A.i = 2 >>> A.i
5
by: johnny | last post by:
I am getting the following errors: File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 679, in _send_output self.send(msg) File "H:\xampp\xampp\xampp\python\lib\httplib.py", line 646, in...
5
by: sarup26 | last post by:
Hello .. I would like to know more about Python and Jython? What is the difference between both of them? What is the future for Jython and which are the areas where it is used? Swot
4
by: John Nagle | last post by:
I'm printing out each entry in "gc.garbage" after a garbage collection in DEBUG_LEAK mode, and I'm seeing many entries like <cell at 0x00F7C170: function object at 0x00FDD6B0> That's the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.