Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,479 members, 7,954,862 topics. Date: Saturday, 21 September 2024 at 11:04 AM |
Nairaland Forum / Science/Technology / Programming / Exclusive Team Python Forum (8009 Views)
Exclusive Tips On Python Programming For Beginners / Photos And Video Of A Flying Car Exclusive Released (2) (3) (4)
(1) (2) (3) (4) (5) (Reply) (Go Down)
Re: Exclusive Team Python Forum by ayomidearo(m): 11:16am On Dec 29, 2014 |
Barywhyte:lool cpthon is python with C language.. Python is a great language... I love it so much |
Re: Exclusive Team Python Forum by Barywhyte(m): 11:24am On Dec 29, 2014 |
ayomidearo: i know it is C. in fact I don't wanna HV anything to do with DAT language. its so fvcking complex. too complex. more difficult than java or c++. c isnt for evryone |
Re: Exclusive Team Python Forum by omoelu1(m): 1:26pm On Dec 29, 2014 |
Barywhyte:the __init__ method as I know it is a constructor, and that's basically what it does. to initialize some values at the time of calling instantiating the class. |
Re: Exclusive Team Python Forum by omoelu1(m): 1:33pm On Dec 29, 2014 |
Barywhyte: print 0812345678 ^ SyntaxError: invalid token |
Re: Exclusive Team Python Forum by ayomidearo(m): 2:41pm On Dec 29, 2014 |
Barywhyte:loool... Very true |
Re: Exclusive Team Python Forum by Barywhyte(m): 8:23pm On Dec 29, 2014 |
omoelu1: I know it is equivalent to constructor in smthin lik java. I just haven't figured out yet exactly how it work or what make so damn important. are you using python3 or 2. u can't do that in 3 or anything below 2.7 while not string it? I mean print "0806654443222" |
Re: Exclusive Team Python Forum by omoelu1(m): 8:48pm On Dec 29, 2014 |
Barywhyte:assume you want to pass an argument to your object(class) just like you pass to an ordinary function. so, the argument the class will take will be created in the __init__ method. for example: say I want to create an employee class of which the name of the employee will be set at the time of instantiation, we can do it like this: (code)... class Employee(): def __init__(self, name): self.empname = name def printName(self): print self.empname ... sdk = Employee("Sodeeq" ) sdk.printName() ... (/code) I hope that's explanatory enough |
Re: Exclusive Team Python Forum by Barywhyte(m): 9:00pm On Dec 29, 2014 |
omoelu1: hmmm. i picked smthin fr here! then in times wen init method take several arguments, do u also pass those to the class object especially in situation where the class takes no argument? like for example, adding salary and age parameters to the empname parameter |
Re: Exclusive Team Python Forum by codeaddict(m): 9:58pm On Dec 29, 2014 |
bump |
Re: Exclusive Team Python Forum by omoelu1(m): 10:04pm On Dec 29, 2014 |
Barywhyte:exactly. the __init__ works like you are defining you class as : class Employee(self, name, age, salary) and calling it as: me = Employee("sdk", 20, 1000000). I hope I have helped a brother |
Re: Exclusive Team Python Forum by Barywhyte(m): 1:51am On Dec 30, 2014 |
omoelu1: yes u have bro but this init thing get more clumsy than this. how does this relate with other functions in and outside the class in which init is defined? e.g can functions in and outside the init function class called both its data and method attributes? since self = instance of class that is yet to b created, how can other objects of that program access the data and method attributes of init function class? again must all python class contain __init__ function? pls don't b annoyed by many questions. |
Re: Exclusive Team Python Forum by omoelu1(m): 5:06am On Dec 30, 2014 |
Barywhyte:why should I be annoyed. no, all Python classes do not necessarily have to contain an __init__ method, as your program would run fine without it. and any data member defined inside the __init__ method becomes available throughout the class (to other methods in the class as well). and they simply have to access it using the same self dot notation I.e self.dataMemberName (with the same name you have in the __init__) are you very comfortable with defining functions (out side OOP)? |
Re: Exclusive Team Python Forum by Barywhyte(m): 7:00am On Dec 30, 2014 |
omoelu1: yes bro very very. am very OK with functional programming. buh i want to grab this oop stuff and very fast too. mayb am too anxious getting it up my sleeve. I'll get surely just am in a hurry lol. what kind of project? games, desktop apps, network, web etc or just a mix of these. are u making money wit python? are u learnin other PL? tnks for the tutorials am trying it out today see if I'll make some important snap. programming is about 'click'. once the concept snapped or clicked into ur head. u are done. finished! |
Re: Exclusive Team Python Forum by omoelu1(m): 9:36am On Dec 30, 2014 |
Barywhyte:Ok, thank goodness you are very familiar with it. now imagine you want to define a class and you want to pass it PARAMETERS just like you would do ordinary functions, now, those parameters will not be directly passed to the class, but to the __init__method. but at the time of instantiation, you would pass the arguments to the object name instead of explicitly calling the __init__ . I'm still a learner in Python and I started not too long ago. I'm through with the basics and I want to go onto desktop apps programming but since I'm learning with my phone and no PC yet, I'm still on hold. |
Re: Exclusive Team Python Forum by Barywhyte(m): 11:10am On Dec 30, 2014 |
how do practice without computer. that's almost impossible |
Re: Exclusive Team Python Forum by ayomidearo(m): 2:47pm On Dec 30, 2014 |
Barywhyte:u can with qpython on android to run .py progs and deuteride to write codes |
Re: Exclusive Team Python Forum by omoelu1(m): 3:19pm On Dec 30, 2014 |
Barywhyte:it is possible. but just so limiting. and how far, have you grasp the oop thing? |
Re: Exclusive Team Python Forum by Barywhyte(m): 3:39pm On Dec 30, 2014 |
ayomidearo: lol I hv no idea. now i got it. |
Re: Exclusive Team Python Forum by Barywhyte(m): 3:45pm On Dec 30, 2014 |
omoelu1: yea yea at least l understood ur tutorial. my head is so heavy today lol. I haven't done practise OK. I started python early this month and I beliv i hv made some progress. this OOP is an hurdle but im hapy i hv great guys here who can help |
Re: Exclusive Team Python Forum by omoelu1(m): 3:54pm On Dec 30, 2014 |
Barywhyte:na so e be jare my bro. I almost gave up the idea of understanding anything oop. from learning php to learning java, I just found oop so difficult to understand. I ran away from java because of it. one minute, I would seem to be getting it, and next, everything go scatter again. Thank God for Python |
Re: Exclusive Team Python Forum by ayomidearo(m): 4:01pm On Dec 30, 2014 |
Barywhyte:have u seen it? |
Re: Exclusive Team Python Forum by Barywhyte(m): 4:10pm On Dec 30, 2014 |
ayomidearo: no. I will c if I can c it in Google play. but am not downloading it. @omoelu1 yes my Oga. no giving up lol. u can return to java now if u want |
Re: Exclusive Team Python Forum by omoelu1(m): 4:36pm On Dec 30, 2014 |
Barywhyte:yes, I'm considering returning to it one of these days, but first, I want to perfect my Python. I have fallen in love with her already, you know. so, how far have you gone with Python? |
Re: Exclusive Team Python Forum by omoelu1(m): 4:38pm On Dec 30, 2014 |
@ Barywhyte visit qpython. com |
Re: Exclusive Team Python Forum by omoelu1(m): 4:38pm On Dec 30, 2014 |
@ Barywhyte visit qpython.com |
Re: Exclusive Team Python Forum by Barywhyte(m): 4:49pm On Dec 30, 2014 |
omoelu1: not anything beyond those on terminal. but u know the beauty of programming is visual. so I want to turn my terminal game to gui. but then I HV to learn abt python gui toolkit wxpython for now. but this __init__ guy blocked me and that was y I cried. but actually am not trying to b a programmer. I just wanna b a pro in automation processes. that require a sound knowledge of scripting language like python. but since python is two in one language, I cant resist the urge delve into little programming. |
Re: Exclusive Team Python Forum by omoelu1(m): 7:26am On Jan 01, 2015 |
Happy new year to all pythonistaz |
Re: Exclusive Team Python Forum by Barywhyte(m): 9:24am On Jan 03, 2015 |
omoelu1: lol... happy new year to you too n evryone. by d way, the qpython is very handing allowing one to do some simple testing on the go. very handy |
Re: Exclusive Team Python Forum by Barywhyte(m): 9:25am On Jan 03, 2015 |
omoelu1: lol... happy new year to you too n evryone. by d way, the qpython is very handy allowing one to do some simple testing on the go. very handy |
Re: Exclusive Team Python Forum by omoelu1(m): 11:18am On Jan 03, 2015 |
Barywhyte:thanks bro. how well are you progressing with python? |
Re: Exclusive Team Python Forum by Barywhyte(m): 11:58am On Jan 03, 2015 |
omoelu1: Honestly it appear am not. for example if I write: wx.Frame.__init__(self) can u explain what's going on here. actually I want convert a cml game codes into GUI with nice graphics features. tkinter isn't very appealing to mr |
Re: Exclusive Team Python Forum by omoelu1(m): 1:38pm On Jan 03, 2015 |
Barywhyte:going by the dot notation' you are calling on the __init__ method of the Frame class which is in turn a sub class of the class wx |
I Don't Need Math / Printing With Vb6 / Who Have Attended Moat Academy Software Bootcamp Training Before?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 52 |