Python Questions ... any gurus here?
Hi I am learning python and I was wondering if anyone could tell me what these are and mean:
Code:
__init__(self) Dereck |
I'm far from a guru, but I believe __init__ is like a constructor function in C++. If you're not familiar with C++ either, than it is basically a function that is called when an object of that type is created. The self is a reference back to the object being created. (A "this" pointer in C++ terminology.)
The __main__ is probably some sort of entry point function that is run with the script is first executed. I don't think any of the few Python scripts I've written have used that before, so I could be way off here. |
thanks , I started out with c++ and stopped learning when I finished classes. then I began trying to learn python. I like c++ and will continue learning but, I am not ready to learn c/c++ yet.
thanks again |
I've just started to learn python, and I loved it, it's really very easy and practical.after c/c++, my coding speed doubled :D
|
i was reading somewhere and python is supposed to be 3 - 5 times faster than java and ?- 10 times faster than c++ ... the time it takes to develop a program, not program speed.
|
Quote:
|
Python has an excellent reputation for rapid prototyping (ie, fast coding, it's a "glue" language meaning you just kinda glue things together and go). In my software engineering class last semester, my professor wanted everyone to use python and suggested that we use the pygtk widgets. None of us had programmed in python before and it took us only a short while to become used to it.
google for dive into python, there is an online version of the book on the author's site and many people will suggest it. Also, pygtk.org for the gtk widgets provides excellent documentation for using them. __init__ is a constructor for a class, __main__ is the main class of the program, similar to main() in a c++ program. |
The usual idiom is
Code:
if __name__ == '__main__': |
hi,
just visit this page and all ur initial doubts will be gone! http://www-106.ibm.com/developerwork...y/l-pyint.html |
thanks guys!! big help , makes the picture come together
...nice site kapsikum! thanks |
All times are GMT -5. The time now is 03:10 AM. |