Skip to content

Commit

Permalink
added posts from tulpar008
Browse files Browse the repository at this point in the history
  • Loading branch information
WBowam committed Apr 13, 2015
1 parent ce8786e commit b737467
Show file tree
Hide file tree
Showing 115 changed files with 24,143 additions and 36 deletions.
149 changes: 149 additions & 0 deletions __init__fang-fa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Won" />
<meta name="copyright" content="Won" />

<meta name="keywords" content="Python, It, " />
<title>__init__()方法 · Tugqi Biz
</title>
<link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://wbowam.github.io/theme/css/style.css" media="screen">
<link rel="stylesheet" type="text/css" href="http://wbowam.github.io/theme/css/solarizedlight.css" media="screen">
<link rel="shortcut icon" href="http://wbowam.github.io/theme/images/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="http://wbowam.github.io/theme/images/apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="57x57" href="http://wbowam.github.io/theme/images/apple-touch-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="http://wbowam.github.io/theme/images/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="http://wbowam.github.io/theme/images/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="http://wbowam.github.io/theme/images/apple-touch-icon-144x144.png" />
<link rel="icon" href="http://wbowam.github.io/theme/images/apple-touch-icon-144x144.png" />
</head>
<body>
<div id="content-sans-footer">
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://wbowam.github.io/"><span class=site-name>Tugqi Biz</span></a>
<div class="nav-collapse collapse">
<ul class="nav pull-right top-menu">
<li ><a href="http://wbowam.github.io">Home</a></li>
<li ><a href="http://wbowam.github.io/categories.html">Categories</a></li>
<li ><a href="http://wbowam.github.io/tags.html">Tags</a></li>
<li ><a href="http://wbowam.github.io/archives.html">Archives</a></li>
<li><form class="navbar-search" action="http://wbowam.github.io/search.html" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span1"></div>
<div class="span10">
<article>
<div class="row-fluid">
<header class="page_header span10">
<h1><a href="http://wbowam.github.io/__init__fang-fa.html"> __init__()方法 </a></h1>
</header>
</div>

<div class="row-fluid">
<div class="span10 article-content">

<h3 id="__">首先复习一下,<a href="http://tulpar008.github.io/pythonzhong-__shuang-xia-hua-xian-de-zuo-yong.html">__(双下划线)的作用</a><a class="headerlink" href="#__" title="Permanent link">&para;</a></h3>
<ul>
<li>
<p>Python中默认的成员函数,成员变量都是公开的(public),而且python中没有类似public,private等关键词来修饰成员函数,成员变量。 </p>
</li>
<li>
<p>可有时候需要用到私有变量,因此诞生了__。 </p>
</li>
<li>
<p>变量名或函数名前加上 ”__“两个下划线,那么这个函数或变量就会为私有的了。</p>
</li>
<li>
<p>私有意味着只有内部能使用,对外部隐藏。 </p>
</li>
<li>
<p>在内部,python使用一种 name mangling 技术,将 __membername替换成 _classname__membername来使用。 <br />
在外部,使用原来的私有成员的名字时,会提示找不到。(达到了隐藏的效果) </p>
</li>
</ul>
<hr />
<p>很显然,__init__是个私有函数</p>
<h5 id="__init__">__init__方法在类的一个对象被建立时,马上运行。这个方法可以用来对你的对象做一些你希望的 初始化 。<a class="headerlink" href="#__init__" title="Permanent link">&para;</a></h5>
<h6 id="_1">注意,这个名称的开始和结尾都是双下划线。<a class="headerlink" href="#_1" title="Permanent link">&para;</a></h6>
<aside>
<hr/>
<nav>
<ul class="articles_timeline">

<li class="previous_article">« <a href="http://wbowam.github.io/django-fen-ye.html" title="Previous: django 分页">django 分页</a></li>

<li class="next_article"><a href="http://wbowam.github.io/pythonzhong-raw_inputhe-inputde-yi-tong-dian.html" title="Next: Python中raw_input和input的异同点">Python中raw_input和input的异同点</a> »</li>
</ul>
</nav>
</aside>
<!-- Duoshuo Comment BEGIN -->
<div class="ds-thread" data-author-key="4433755"></div>
<script type="text/javascript">
var duoshuoQuery = {short_name:"tlbog"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = 'http://static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<!-- Duoshuo Comment END -->
</div>
<section>
<div class="span2" style="float:right;font-size:0.9em;">

<h4>Published</h4>
<time pubdate="pubdate" datetime="2014-07-07T00:00:00+08:00">Jul 7, 2014</time>
<h4>Category</h4>
<a class="category-link" href="/categories.html#It-ref">It</a>
<h4>Tags</h4>
<ul class="list-of-tags tags-in-article">
<li><a href="/tags.html#Python-ref">Python
<span>13</span>
</a></li>
</ul>

</div>
</section>
</div>
</article>
</div>
<div class="span1"></div>
</div>
</div>
</div>
<footer>
<div id="footer">
<ul class="footer-content">
<li class="elegant-power">Powered by <a href="http://getpelican.com/" title="Pelican Home Page">Pelican</a>. Theme: <a href="http://oncrashreboot.com/pelican-elegant" title="Theme Elegant Home Page">Elegant</a> by <a href="http://oncrashreboot.com" title="Talha Mansoor Home Page">Talha Mansoor</a></li>
</ul>
</div>
</footer> <script src="http://code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
<script>
function validateForm(query)
{
return (query.length > 0);
}
</script>

</body>
</html>
Loading

0 comments on commit b737467

Please sign in to comment.