In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about the pros and cons of python object-oriented programming. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. The complexity of programming is much higher than process-oriented. If you do not understand object-oriented, you can start the design-based program immediately, which is prone to the problem of over-design.
In some scenarios with low scalability requirements, the use of object-oriented will increase the difficulty of programming. For example, the shell script for managing linux systems is not suitable for object-oriented design, and process-oriented is more suitable.
2. The process-oriented programming pipeline can accurately predict the process and results of the problem.
Once the object-oriented program starts, the interaction between objects will solve the problem, and even God cannot accurately predict the final result. So we often see combat games, add a game character, in the course of combat is very easy to appear Yin bully skills, a knife to kill three people, this situation can not be accurately predicted, only the interaction between objects can accurately know the final result.
Example
# here put the import lib # create a class The features and functions of this class are similar to class teacher (object): def _ init__ (self, name, age, course): self.name = name self.age = age self.course = course def intro (self): print ("% s is% s years old."% (self.name, self.age)) def attend_class (self): print ("% s teach% s"% (self.name) Self.course)) # create a specific object The specific characteristics and functions of the object. T1 = teacher ("sunny chen", 21, "python") t1.attend_class () # this is object-oriented programming in Python, which integrates the features and functions of a class of things by defining classes, and then concretely to the specific features and functions of a certain thing through the object. # that is, the class is equivalent to a money printing machine, and the object is equivalent to RMB. Thank you for your reading! This is the end of this article on "what are the advantages and disadvantages of python object-oriented programming". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.