473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

def __init__ question in a class definition

Hi There,

I have an open source program which i am trying to add to.

class classname(membe r,member)

def __init__(self,l ist)
self.__list = list
self.refresh = 360

my question is what is the __ (double underscore) represent, if
anything, in this bliock of assignmeents? I wish to add some more names
but do not know if i need the __ or not?

IE: is there any special significance to the __ in this case.

Cheers


--
Jeffrey Borkent
Systems Specialist
Information Technology Services
University of Adelaide
Level 7, 10 Pultney Street
Adelaide. 5005
Ph: 8303 3000
je************* @adelaide.edu.a u
---------------------------------
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.

Jul 18 '05 #1
4 1529
>Jeffrey Borkent
Systems Specialist
Information Technology Services


With that kind of credentials, and the fact that you claim you are a
system specialists....
I don't know you have me worried already.
I guess for you I just say RTFM.
If you think that is harsh then don't ask a 2nd grade question yet
claim/pretend to be some sorta system specialists.
You tried searching the archives first I am sure.
Go here http://www.python.org and *read*, come back when you are
really stuck.
M.E.Farmer
P.S. YES the __ matter, they identify special methods ! __init__ is the
class CONSTRUCTOR.

Jul 18 '05 #2
M.E.Farmer wrote:
Jeffrey Borkent
Systems Specialist
Information Technology Services

With that kind of credentials, and the fact that you claim you are a
system specialists....
I don't know you have me worried already.
I guess for you I just say RTFM.
If you think that is harsh then don't ask a 2nd grade question yet
claim/pretend to be some sorta system specialists.


Hey, ease up, this is comp.lang.pytho n, remember.
You tried searching the archives first I am sure.
Go here http://www.python.org and *read*, come back when you are
really stuck.
M.E.Farmer
P.S. YES the __ matter, they identify special methods ! __init__ is the
class CONSTRUCTOR.

Next time, could we try exchanging the body of the message and the PS?
That way you could have omitted the PS when you got half way through it
and realised you were just wasting your time and everyone else's ...

got-out-the-wrong-side-of-bed-ly y'rs - steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenweb.com/
Jul 18 '05 #3
Steve Holden wrote:
M.E.Farmer wrote:
Jeffrey Borkent
Systems Specialist
Information Technology Services

With that kind of credentials, and the fact that you claim you are a system specialists....
I don't know you have me worried already.
I guess for you I just say RTFM.
If you think that is harsh then don't ask a 2nd grade question yet
claim/pretend to be some sorta system specialists.


Hey, ease up, this is comp.lang.pytho n, remember.
You tried searching the archives first I am sure.
Go here http://www.python.org and *read*, come back when you are
really stuck.
M.E.Farmer
P.S. YES the __ matter, they identify special methods ! __init__ is the class CONSTRUCTOR.

Next time, could we try exchanging the body of the message and the

PS? That way you could have omitted the PS when you got half way through it and realised you were just wasting your time and everyone else's ...

got-out-the-wrong-side-of-bed-ly y'rs - steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenwewb.com P.S. And in an effort to keep on topic...PYCON!!
steve,
I stand by what I said.
Teach a man to fish feed him for a lifetime.
Re-read it, memorize it, and keep it near.
I read comp.lang.py for 3 years before I posted anything, and then i
posted an ANSWER!
I don't go around asking dirt simple questions that would be solved
with a quick read of the docs, usenet archives , Google, books that
have been written about Python,etc.... He should have been *reading*
not *posting*.
I can not understand why you have a problem with me pointing out he
should read the documentation. Why do you think RTFM exist, for people
like that, they are a timesink. He can redeem himself if he just goes
and reads a little and comes back looking like he made some effort.
This guy has a 6 mile sig that says he ought to know better. Had he
come with a different sig *maybe* and a question that did not scream
'''HEY I WANT YOU TO ANSWER EVERYTHING FOR ME BECAUSE I CAN NOT EVEN
READ THE BASIC DOCUMENTATION ON MY OWN'''.
Next time, could we try exchanging the body of the message and the PS? That way you could have omitted the PS when you got half way through it and realised you were just wasting your time and everyone else's ...
I tell him where he is wrong first then I answer the question, sounds
like *YOU* ....Now I have your attention.
What do you think that post was meant to do? Snap him off at the root?
Make him cry? Maybe it was to nudge him to read the docs, so he can
*learn* on his own.
Next time you could just write my post for me! That way I can only
waste as much time as you deem acceptable! Now that I think about it,
if we just answer every question every poster has about any detail of
Python, then we can all sing along and hold hands, who needs to write
documentation or even books about Python look at all the time we will
save...
got-out-the-wrong-side-of-bed-ly y'rs - steve

Which-side is-the wrong-side-ly yr's - M.E.Farmer

Jul 18 '05 #4
M.E.Farmer wrote:
Steve Holden wrote:
M.E.Farmer wrote:

Jeffrey Borkent
Systems Specialist
Informati on Technology Services
With that kind of credentials, and the fact that you claim you are
a
system specialists....
I don't know you have me worried already.
I guess for you I just say RTFM.
If you think that is harsh then don't ask a 2nd grade question yet
claim/pretend to be some sorta system specialists.


Hey, ease up, this is comp.lang.pytho n, remember.

You tried searching the archives first I am sure.
Go here http://www.python.org and *read*, come back when you are
really stuck.
M.E.Farmer
P.S. YES the __ matter, they identify special methods ! __init__ is
the
class CONSTRUCTOR.


Next time, could we try exchanging the body of the message and the


PS?
That way you could have omitted the PS when you got half way through


it
and realised you were just wasting your time and everyone else's ...

got-out-the-wrong-side-of-bed-ly y'rs - steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenwewb.com


P.S. And in an effort to keep on topic...PYCON!!
steve,
I stand by what I said.
Teach a man to fish feed him for a lifetime.
Re-read it, memorize it, and keep it near.
I read comp.lang.py for 3 years before I posted anything, and then i
posted an ANSWER!
I don't go around asking dirt simple questions that would be solved
with a quick read of the docs, usenet archives , Google, books that
have been written about Python,etc.... He should have been *reading*
not *posting*.
I can not understand why you have a problem with me pointing out he
should read the documentation. Why do you think RTFM exist, for people
like that, they are a timesink. He can redeem himself if he just goes
and reads a little and comes back looking like he made some effort.
This guy has a 6 mile sig that says he ought to know better. Had he
come with a different sig *maybe* and a question that did not scream
'''HEY I WANT YOU TO ANSWER EVERYTHING FOR ME BECAUSE I CAN NOT EVEN
READ THE BASIC DOCUMENTATION ON MY OWN'''.

Next time, could we try exchanging the body of the message and the


PS?
That way you could have omitted the PS when you got half way through


it
and realised you were just wasting your time and everyone else's ...

I tell him where he is wrong first then I answer the question, sounds
like *YOU* ....Now I have your attention.
What do you think that post was meant to do? Snap him off at the root?
Make him cry? Maybe it was to nudge him to read the docs, so he can
*learn* on his own.
Next time you could just write my post for me! That way I can only
waste as much time as you deem acceptable! Now that I think about it,
if we just answer every question every poster has about any detail of
Python, then we can all sing along and hold hands, who needs to write
documentation or even books about Python look at all the time we will
save...

got-out-the-wrong-side-of-bed-ly y'rs - steve


Which-side is-the wrong-side-ly yr's - M.E.Farmer

Well, actually my point was that if we just save time by not answering
such questions we avoid a reputation for hostility while still
encouraging people to use other resources. But anyway, thanks for saying
"PyCon"!

regards
Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenweb.com/
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1991
by: user | last post by:
I have gotten properties to respond correctly, but when I try to do it in __init__: class foo: def getter(self): return "hello" def __init__(self):
3
1700
by: Zunbeltz Izaola | last post by:
Hi, I'm playing with __slot__ (new class) and the __init__ method of my class. I want the arguments of __init__ to be keywords and that the method initialize all the attributes in __slot__ to None except those in the argument of __init__ (Is this a good practice?). I've the following class class PersonalData(object):
3
1594
by: paul kölle | last post by:
Hi list, in the course of writing a small app, I tried to design a class, which would allow to derive its behaviour solely from its name, so that I would be able to write one abstract class with the logic and get different objects/instances by subclassing with appropriate names. Consider the following: ATTRS = {'one':, 'two':,
1
1954
by: Jeffrey Borkent | last post by:
Hi There, Please let me rephrase the problem as many people misunderstood what i was trying to ask. I know that the __init__ is the class constructor, that was not my question. under the def __init__ are several assignments
2
1572
by: Thomas Bartkus | last post by:
If I insert an __init__ method in my own class definition, it is incumbent upon me to call the __init__ of any declared ancester to my new class object because my __init__ will override that of any ancester I declare in the header. If I fail to call the ancesters __init__, then it won't happen. The ancester object won't be initialized. But If I *don't* insert my own __init__ in my new class, then any declared ancester __init__ will...
6
2541
by: Ray Schumacher | last post by:
What is the feeling on using "parent" in a class definition that class methods can refer to, vs. some other organization ? Should all relevant objects/vars just be passed into the method as needed? It seems like including "parent" in the class def is just like a class variable, which most do not recommend. An example: class LXSerial: def __init__(self, parent, debug=False): ...
16
2909
by: digitalorganics | last post by:
What's the difference between initializing class variables within the class definition directly versus initializing them within the class's __init__ method? Is there a reason, perhaps in certain situations, to choose one over the other? Thank you.
10
1675
by: ryanshewcraft | last post by:
Let me start with my disclaimer by saying I'm new to computer programming and have doing it for the past three weeks. I may not be completely correct with all the jargon, so please bear with me. Anyways, I'm writing a function which has a class called "MultipleRegression." I want one of the variables under the __init__ method to be a list. I've got: class MultipleRegression: def __init__(self, dbh, regressors, fund):
25
2496
by: Erik Lind | last post by:
I'm new to Python, and OOP. I've read most of Mark Lutz's book and more online and can write simple modules, but I still don't get when __init__ needs to be used as opposed to creating a class instance by assignment. For some strange reason the literature seems to take this for granted. I'd appreciate any pointers or links that can help clarify this. Thanks
43
3194
by: kenneth | last post by:
Dear all, I have encountered this weird problem. I have a class definition with an __init__ argument 'd' which defaults to {}. This argument is put in the 'self.d' attribute at initialization I create two independent instances of this class; the code is as follows.
0
8067
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8010
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8483
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6820
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5479
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3967
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1336
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.