#9 Class Instance Python/

Python allow to object oriented programming (OOP). That is make a code writing so fast. Because object oriented programming reuse another code that containt formula and data.

As OOP, main emphasis of Python is on object. Another progamming paradigm, procedure oriented programming stress on function.

Object is set of data (variable) and method (functions) that can work on data. To create an object, programmer create a blueprint, first, then create object. The blueprint is named a class. Then we can make multiple object based on a classs. That is make coding faster, easier to write and read.

Class is reusable object as blue print that contain attribut and methods. A class is a description of an object’s characteristics.

Some book say that class is also an object. So, to prevent confusion, some writer give different name for object, it is instance. Instance is an object that is create based on class/ or bluprint.

Create Class

Usually, people called create class as class definiton. Inside the class, there are data attributes and procedures. 

The syntax of class definition is:

class MyClass:
    statement or instruction

That is formula to crate class. Example of simple class is :

class MyClass:
  x = 5
  def func(self):
      print (hello)

That example is a class that have a attribute x = 5 and also method or function. The function is func(). 

Parameter and argument

Class have (1) data or property /attribute and also (2) methods or function. Function have characteristics in python. It have parentheses (). Inside parentheses, there is parameters. Parameter are specified value after the function name. Parameter in inside the parentheses. We can give empty parameter, one, two and more. We can add as many parameters as you want. To create multiple parameter we can just separate them with a comma

Value of parameter is argument. If your parameter is “name”, the argument is “John”, “Mary” and so on.

We can also give default value parameter. For example,

def my_function(country= "United States"):
  print("I am from " + country)

my_function("Indonesia")
my_function("Australia")
my_function("Italia")
my_function()

If the argument of function is empty, It will show default argument or parameter value.

Create an instance

To reuse a class, we can create instance of class. To reuse a class, we can import the class first, if the class in different file. If a class in same file with an instance, import is not necessary.

import MyClass

newinstance = classname.function(parameter)
newinstance.function(parameter)

Each instance of a class has characteristics of class. Each instance have clone datas and methods of class. Instance also can modify data without destroy class. So, class can be starting point to create new instance. 

Why this blog talk about Python?

After reading Jamal Khashoggi case, I aware that economic and political ambition sometimes is blind to another consideration outside the ambition. The consideration includes a love of human and environment. Ambition makes human to be packman that cost on another human and environment.

That is not just coinsidence, but logical consequencies if they think that ambition is has to be reach at all cost.

So, I didn’t want to only talk about business in this blog. I want to talk about multiple beautiful things in our world. Not just business. I will to also to talk about programming that connects to the internet, I choose python. Python have capabilities to manage big data.

To Monitor Bot and Big Data

Why I talk about programming and big data. Big data and the bot can help the packman to manipulate and violate human and environment. So I need to monitor and update about big data and the bot. It help to monitor bad effect of big data.

To Reduce Excessive Ambition

The second point is it is good for the human to reduce the priority of one side ambition. Political and economic ambition only is one side ambition. I think it is good to find another simple pleasure. So we can recode one side ambition. Python is one of simple pleasure.

That is why I will talk about learning python and big data. Python is one of simple pleasure that I hope reduce excessive ambition.

To Handle Business Task

The third point is programming can help to handle the business task. Programming also helps us with getting information that matters. I have an idea to make an easier business task, for example: create a business plan, monitor opportunity, and threat.

Python is one of programming language on a computer. If we write in python language, we can give instruction to a computer. The computer can do our job, include big or repetitive jobs. Without programming language, the computer cannot obey our instruction. Python is one of programming language among another programming language like C+, Java, Visual Basic, R, Ruby and so on.