About python, class

A note about the Person class.

Below, let's create a Person class.

class Person:
 
 #Initial setting
 def __init__(self, name,company,age):#self is necessary for the time being
   self.name = name
   self.company = company
   self.age = age

 def say_hello(self,name):#self is necessary for the time being
   print("Hello{}Mr. I{}is.".format(name, self.name))

 def __call__(self, name):#self is necessary for the time being
   print("Hello{}Mr. I{}is.".format(name, self.name))
 
-------------------------------------------------------
Suzuki = Person("Suzuki","ABC Trading",45)
Suzuki.name
#Suzuki

Suzuki.say_hello("Kato")
#Hello Mr. Kato. I'm Suzuki.

Suzuki("Tanaka")
#Hello Mr. Tanaka. I'm Suzuki.
#call function is Suzuki.__call__("Tanaka")You don't have to (this is possible but not appropriate)

Recommended Posts

About python, class
About python comprehension
"Kanrika" python class
About Python tqdm.
About python yield
About python inheritance
About python, range ()
About python decorators
Python class, instance
About python reference
About Python decorators
[Python] About multi-process
#Python basics (class)
Talking about Python class attributes and metaclasses
About Python for loops
About Class and Instance
python syslog wrapper class
Summary about Python scraping
About function arguments (python)
case class in python
[Python] Class inheritance (super)
Python self-made class sort
[python] class basic methods
[Python] Memo about functions
Summary about Python3 + OpenCV3
[Python] Class inheritance, override
About Python, for ~ (range)
About Python3 character code
[Python] Memo about errors
About Python development environment
python subprocess wrapper class
Python: About function arguments
Python, about exception handling
About Python Pyramid traversal
About Python3 ... (Ellipsis object)
[Python] Chapter 01-01 About Python (First Python)
[Python] About standard input
About __all__ in python
YOLO Python wrapper class
Class notation in Python
Python exception class list
[Python] Find out about pip
Python: Class and instance variables
About Fabric's support for Python 3
Python
About python objects and classes
About Python variables and objects
C / C ++ programmer challenges Python (class)
About the Python module venv
Think about architecture in python
About python beginner's memorandum function
About the ease of Python
class
About the enumerate function (python)
About various encodings of Python 3
Python class member scope summary
About Python, len () and randint ()
About Perl, Python, PHP, Ruby
About Python datetime and timezone
A memorandum about correlation [Python]
Python class variables and instance variables