gh-pages
krahets 2 years ago
parent 44272f2001
commit 7752a20cf0

@ -2722,7 +2722,7 @@
<a id="__codelineno-62-4" name="__codelineno-62-4" href="#__codelineno-62-4"></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<a id="__codelineno-62-5" name="__codelineno-62-5" href="#__codelineno-62-5"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;构造方法&quot;&quot;&quot;</span>
<a id="__codelineno-62-6" name="__codelineno-62-6" href="#__codelineno-62-6"></a> <span class="bp">self</span><span class="o">.</span><span class="n">__capacity</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">10</span> <span class="c1"># 列表容量</span>
<a id="__codelineno-62-7" name="__codelineno-62-7" href="#__codelineno-62-7"></a> <span class="bp">self</span><span class="o">.</span><span class="n">__nums</span><span class="p">:</span> <span class="n">my_list</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">__capacity</span> <span class="c1"># 数组(存储列表元素)</span>
<a id="__codelineno-62-7" name="__codelineno-62-7" href="#__codelineno-62-7"></a> <span class="bp">self</span><span class="o">.</span><span class="n">__nums</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">__capacity</span> <span class="c1"># 数组(存储列表元素)</span>
<a id="__codelineno-62-8" name="__codelineno-62-8" href="#__codelineno-62-8"></a> <span class="bp">self</span><span class="o">.</span><span class="n">__size</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># 列表长度(即当前元素数量)</span>
<a id="__codelineno-62-9" name="__codelineno-62-9" href="#__codelineno-62-9"></a> <span class="bp">self</span><span class="o">.</span><span class="n">__extend_ratio</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">2</span> <span class="c1"># 每次列表扩容的倍数</span>
<a id="__codelineno-62-10" name="__codelineno-62-10" href="#__codelineno-62-10"></a>

File diff suppressed because one or more lines are too long

Binary file not shown.
Loading…
Cancel
Save