Python : Data Encapsulation
Python : Data Encapsulation
The following table shows the different behaviour:
| Name | Notation | Behaviour |
|---|---|---|
| name | Public | Can be accessed from inside and outside |
| _name | Protected | Like a public member, but they shouldn't be directly accessed from outside. |
| __name | Private | Can't be seen and accessed from outside |
e.g.
class Account(object):
counter = 0
def __init__(self, holder, number, balance,credit_line=1500):
Account.counter += 1
self.__Holder = holder
self.__Number = number
self.__Balance = balance
self.__CreditLine = credit_line
def __del__(self):
Account.counter -= 1
Python : Data Encapsulation的更多相关文章
- 【Python学习笔记】Coursera课程《Python Data Structures》 密歇根大学 Charles Severance——Week6 Tuple课堂笔记
Coursera课程<Python Data Structures> 密歇根大学 Charles Severance Week6 Tuple 10 Tuples 10.1 Tuples A ...
- Objective-C Data Encapsulation
All Objective-C programs are composed of the following two fundamental elements: Program statements ...
- 《Python Data Structures》Week5 Dictionary 课堂笔记
Coursera课程<Python Data Structures> 密歇根大学 Charles Severance Week5 Dictionary 9.1 Dictionaries 字 ...
- 《Python Data Structures》 Week4 List 课堂笔记
Coursera课程<Python Data Structures> 密歇根大学 Charles Severance Week4 List 8.2 Manipulating Lists 8 ...
- Python Data Visualization Cookbook 2.2.2
import csv filename = 'ch02-data.csv' data = [] try: with open(filename) as f://用with语句将数据文件绑定到对象f r ...
- python data analysis | python数据预处理(基于scikit-learn模块)
原文:http://www.jianshu.com/p/94516a58314d Dataset transformations| 数据转换 Combining estimators|组合学习器 Fe ...
- Python Data Science Toolbox Part 1 Learning 1 - User-defined functions
User-defined functions from:https://campus.datacamp.com/courses/python-data-science-toolbox-part-1/w ...
- [Machine Learning with Python] Data Preparation through Transformation Pipeline
In the former article "Data Preparation by Pandas and Scikit-Learn", we discussed about a ...
- [Machine Learning with Python] Data Preparation by Pandas and Scikit-Learn
In this article, we dicuss some main steps in data preparation. Drop Labels Firstly, we drop labels ...
随机推荐
- SQLServer死锁查询
--查询死锁 select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys ...
- STS插件创建springboot项目,pom第一行报unkown错误
Description Resource Path Location TypeUnknown pom.xml /amq-provider line 1 ...
- 获取用户真实IP:(模拟:客户端--F5--nginx--tomcat 后端获取用户真实IP)
模拟:客户端--F5--nginx--tomcat 后端获取用户真实IP 192.168.109.137 :nginx01(充当第一层代理==F5)192.168.109.138 :nginx02(二 ...
- 关于discuz论坛邮箱配置
Discuz后台可以进行邮件设置,实现网站自动发送邮件给用户的邮箱. 在Discuz邮件设置,经常使用25端口普通发送邮件.为了数据安全,我们也可以使用SSL加密发送,设置方法很简单,只需按照下图进行 ...
- nginx windows 代理 80端口 500
今天准备配置一个nginx 用来代理80端口分别访问.net core 和spring boot 服务器 配置使用的最基本的代理配置 #user nobody; worker_processes 1; ...
- 命令行界面CLI
1.hive -e --执行一个或多个查询 hive -e "select * from student limit 3" 2. hive -e > 将临时查询保 ...
- 一个奇怪的问题:Last_Errno: 1264 Error 'Out of range value for column 0x322E36343030
场景环境: 1. 主从都是:Server version: 5.7.16-log MySQL Community Server (GPL) 2.操作系统:CentOS release 6.7 (Fin ...
- k8s+jenkins
1 server 的port , targetport, nodeport的区别 targetport为容器的暴露端口,为最后端的端口 port可以理解为pod的端口,pod是容器的外层,该端口可以在 ...
- Spring MVC (二)
一.使用 @RequestMapping 映射请求 Spring MVC使用@RequestMapping注解为控制器指定可以处理哪些URL请求 在控制器的类定义以及方法定义处都可以标注 类定义处:提 ...
- python实现Restful服务(基于flask)(2)
参考:https://blog.csdn.net/yelena_11/article/details/53404892 最简单的post例子: from flask import Flask, req ...