Python Object-oriented properties

Source: Internet
Author: User

Also has not been updated for a long time, the main thing to write today is about the object-oriented properties of the problem.

The explanation of the property is that the method can be simply understood as a method but a field is called. In addition, the other is no adorner, using Python to provide the way to write, according to your different objects to use, in fact, is also the definition of the method, to use the object call.

1 classObject:2     defF1 (self):3         return '123'4     defF2 (self, value):5         Print(value)6     defF3 (self):7A = 1 + 18         Print(a)9Foo = property (Fget=f1, Fset=f2, fdel=f3)Ten  Onep =Object () Aresult =P.foo - Print(Result) -P.foo ='Week' the delP.foo
View Code

One is to define the method first, followed by the Fget, Fset, Fdel of the adorner in the way that corresponds to the method. Then it is called with the object. It's just that this way feels more elegant.

PS: Parallel and distributed issues, discussed today under the main grasp a bit of parallel results of mutual influence, distributed results do not affect each other.

This is similar to doing a eight-step thing, parallel is the work required to divide the workload into eight parts, and distributed is equivalent to divided into eight sections, each to do, and then collide with the results. For example, gender (male and female), body (height), body shape (fat thin), eyesight (wearing glasses, not wearing) this if the non-distributed look is 2*2*2*2, the training set is not enough may not be able to determine whether the person wearing glasses. It is equivalent to the message is passed back to the past, but there is loss or distortion in the middle, and not enough to verify may not be allowed. Or, judging whether to wear glasses is dependent on the last condition of the body of the combination of things down. Did not do beyond or cross the previous node condition, according to the given algorithm sequence down, can not directly and gender "communication" or judgment. And distributed is, directly divided into (male, female, fat, thin, high, short, wearing, not wearing) These eight attributes, free to learn collision. This is, for example, the equivalent of direct communication, not completely rely on the middle of the transfer, do not need a lot of training set to fix (quite a few times we need to communicate with each other I trust you this person, you bring the upper information is true, distributed directly can communicate with the upper layer collision). But to learn from each other, to verify (direct ask), and ultimately to judge this wear without wearing glasses. Eight attributes all have information that the other person does not know, touches each other to complement. In the past, the workload was evenly divided, and the results were combined. This understanding, the assembly of a car, need eight parts, distributed is equivalent to let eight people each responsible for one, their own collision how to assemble the car better. Non-distributed is equivalent to the amount of work divided into eight people, step by step, the middle of the need for a large amount of data to correct the previous step to convey the accuracy. For example, there is a 1 flaw that you might want to find out from a lot of data corrections, but distributed is the flaw that asks 1 directly in a collision.

Python Object-oriented properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.