Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,624 members, 7,816,568 topics. Date: Friday, 03 May 2024 at 01:15 PM

Exclusive Team Python Forum - Programming (4) - Nairaland

Nairaland Forum / Science/Technology / Programming / Exclusive Team Python Forum (7852 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:


lol cpython? hmmm. bro one thing at a time lol. so many stuff to learn. am still tryin to figure __init__ method in python. i just wish I can do away with it and write my program normally. but I can't. its d first weird thing I have seen in python.
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:
lool cpthon is python with C language.. Python is a great language... I love it so much

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:


lol cpython? hmmm. bro one thing at a time lol. so many stuff to learn. am still tryin to figure __init__ method in python. i just wish I can do away with it and write my program normally. but I can't. its d first weird thing I have seen in python.
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:


put d code line here and its traceback. lets c wht ur trying to do.

print 0812345678
^
SyntaxError: invalid token
Re: Exclusive Team Python Forum by ayomidearo(m): 2:41pm On Dec 29, 2014
Barywhyte:


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
loool... Very true
Re: Exclusive Team Python Forum by Barywhyte(m): 8:23pm On Dec 29, 2014
omoelu1:

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.

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:


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"
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:

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


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:


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
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:

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

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:


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.
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:

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)?

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:


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!
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:
how do practice without computer. that's almost impossible
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:
how do practice without computer. that's almost impossible
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:
u can with qpython on android to run .py progs and deuteride to write codes

lol I hv no idea. now i got it.
Re: Exclusive Team Python Forum by Barywhyte(m): 3:45pm On Dec 30, 2014
omoelu1:

it is possible. but just so limiting.
and how far, have you grasp the oop thing?

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:


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
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:


lol I hv no idea. now i got it.
have u seen it?
Re: Exclusive Team Python Forum by Barywhyte(m): 4:10pm On Dec 30, 2014
ayomidearo:
have u seen it?

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:


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
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:

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?

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:
Happy new year to all pythonistaz

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:
Happy new year to all pythonistaz

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:


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
thanks bro.
how well are you progressing with python?
Re: Exclusive Team Python Forum by Barywhyte(m): 11:58am On Jan 03, 2015
omoelu1:

thanks bro.
how well are you progressing with python?

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:


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
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

(1) (2) (3) (4) (5) (Reply)

Embedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) / How Can I Generate Phone Numbers / 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. 62
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.