property干嘛的
>>> import datetime
>>> class c():
@property
def noww(self):
return datetime.datetime.now() >>> c.noww
<property object at 0x00000000031DE908>
>>> x=c()
>>> x.noww
datetime.datetime(2014, 1, 27, 13, 17, 14, 725610)
>>> x.noww
datetime.datetime(2014, 1, 27, 13, 17, 27, 8740)
>>> x.noww()
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
x.noww()
TypeError: 'datetime.datetime' object is not callable
看来应该是免得每次都要敲对括号
property干嘛的的更多相关文章
- easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined
1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问 ...
- 利用@property实现可控的属性操作
利用@property实现可控的属性操作 Python中没有访问控制符, 不像java之类的 public class Person{ private int x public int getAge( ...
- Android 属性动画(Property Animation) 完全解析 (上)
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38067475 1.概述 Android提 供了几种动画类型:View Anima ...
- 分分钟知道tiles框架是干嘛的
分分钟知道tiles框架是干嘛的 http://blog.sina.com.cn/s/blog_a123d4d50101792d.html参考上面的文章,简单明了.让你一下子就知道这个是用来做什么的. ...
- 【转】Android 属性动画(Property Animation) 完全解析 (上)
http://blog.csdn.net/lmj623565791/article/details/38067475 1.概述 Android提供了几种动画类型:View Animation .Dra ...
- python面对对象编程-------5:获取属性的四种办法:@property, __setattr__(__getattr__) ,descriptor
一:最基本的属性操作 class Generic: pass g= Generic() >>> g.attribute= "value" #创建属性并赋值 > ...
- ios @property
参考资料 http://blog.csdn.net/pingchangtan367/article/details/14000315 http://blog.csdn.net/xdrt81y/arti ...
- IOS 关于property的详细解法
1.格式 @property (参数1,参数2,...) 类型 名字; eg: @property(nonatomic,retain) UIWindow *window; 其中参数主要分为三类: • ...
- 聊聊属性方法property的用法
写之前随便百度了一下博客,又看到廖雪峰的博客了.果然置顶的能力很强. 我想说其实property的用法并不是主要用来做类型检查.反而更多应该是用于简化操作的目的. 写之前想聊一个古老的话题.年初的时候 ...
随机推荐
- [LeetCode] Equal Tree Partition 划分等价树
Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to tw ...
- python 作业 编写登陆接口
# -*- coding:utf-8 -*-import os,sysfor i in range(3):#进行3次循环 blacklist = open(r"C:\Users\Pc4\De ...
- python3+dlib人脸识别及情绪分析
一.介绍 我想做的是基于人脸识别的表情(情绪)分析.看到网上也是有很多的开源库提供使用,为开发提供了很大的方便.我选择目前用的比较多的dlib库进行人脸识别与特征标定.使用python也缩短了开发周期 ...
- 例10-1 uva11582(裴波那切数列)
题意:你的任务是计算f(a^b)除以n的余数.其中f(0)=f(1)=1,且对于所有非负整数i,f(i+2)=f(i+1)+f(i). 思路: 由于是模运算,因此整个序列肯定会出现重复序列,所以先找出 ...
- *hdu 5536(字典树的运用)
Input The first line of input contains an integer T indicating the total number of test cases. The f ...
- [BZOJ]1018 堵塞的交通(SHOI2008)
一道有点神的线段树. Description 有一天,由于某种穿越现象作用,你来到了传说中的小人国.小人国的布局非常奇特,整个国家的交通系统可以被看成是一个2行C列的矩形网格,网格上的每个点代表一个城 ...
- Ubuntu 16.04 Vim安装及配置【转】
转自:http://www.cnblogs.com/ace-wu/p/6273031.html 安装VIM 默认已经安装了VIM-tiny acewu@acewu-computer:~$ locate ...
- rsync 系统用户/虚拟用户 备份web服务器数据及无交互定时推送备份
一.服务环境 (1),WEBserver(192.168.10.130) : BACKserver(192.168.10.129) (2),BACKserver服务器部署,安装所需软件,并启动 (3) ...
- swift之属性
知识点总结: 1.存储属性 struct Town{ let region = "South" //只读属性 var population = //读写属性 } 2.惰性存储属性 ...
- 15. 3Sum(中等)
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...