python - what is the method attribute
2012-11-22 00:00
239 查看
Method attribute, the name sound a bit bizarre at first sight, does it mean some attribute that you can use on the method, like the attribute @attribute notation in java language? but, as we already know that we have python construct that is called decorator, which has the same syntax as the @decorator ; so it apparantly not the decorator. so , what is it indeed?
Suppose a classes is what the methods inside it defines it, like if you have a __str__method, then you can be treated as the string object (through a concpet what wer refers to as duck typing). so if a classes is defined by the method within, then we can think the method that give classes spcial behavior as attributes to the classes.
common method attributes include "str" which can help convert an object to string. "getitem" which give you the ability to access the object through indexer (object
)...
Suppose a classes is what the methods inside it defines it, like if you have a __str__method, then you can be treated as the string object (through a concpet what wer refers to as duck typing). so if a classes is defined by the method within, then we can think the method that give classes spcial behavior as attributes to the classes.
common method attributes include "str" which can help convert an object to string. "getitem" which give you the ability to access the object through indexer (object
)...
相关文章推荐
- What is the difference between @staticmethod and @classmethod in Python?
- 18 What is the __dict__.__dict__attribute of a Python class
- what is the different between function and method in python
- The following code fails when ExecMethod is called. Can anyone pinpoint what I am doing wrong?
- What is the best Java email address validation method?
- What is the difference between routine , method , procedure , function ? please explain it with example?
- Part 68 - What is the use of NonAction attribute in mvc
- What is the difference between Array.Clone and Array.Copy Method
- The usage of the Javascript method call and apply(what is the new and object.create difference.)(What does call(null) mean?)
- what is the SEL,id and IMP,Class ,Method?
- What is the defining attribute for an entity?
- he method setAttribute(String,object)in the type HttpSession is not appl
- What is the difference between BIT and TINYINT in MySQL
- What is the difference between pages and blocks?
- What is the Best Programming Language to Learn in 2014?
- The value for the useBean class attribute is invalid 问题
- What is the use of "?
- what is the “handover” and "soft handover" in mobile communication system?
- [Python]--What are the differences between numpy arrays and matrices?
- What is the $ symbol used for in JavaScript