PageRenderTime 33ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/1.1.10/generated/cf.FieldList.count.html

https://bitbucket.org/cfpython/cfpython.bitbucket.org
HTML | 189 lines | 145 code | 14 blank | 30 comment | 0 complexity | 1b62638de2f15afd617ba9d27cf27b01 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>cf.FieldList.count &mdash; Documentation</title>
  7. <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
  8. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '1.1.10',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../_static/underscore.js"></script>
  20. <script type="text/javascript" src="../_static/doctools.js"></script>
  21. <script type="text/javascript" src="../_static/copybutton.js"></script>
  22. <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  23. <link rel="top" title="Documentation" href="../index.html" />
  24. <link rel="up" title="cf.FieldList" href="../classes/cf.FieldList.html" />
  25. <link rel="next" title="cf.FieldList.extend" href="cf.FieldList.extend.html" />
  26. <link rel="prev" title="cf.FieldList.append" href="cf.FieldList.append.html" />
  27. </head>
  28. <body role="document">
  29. <div class="related" role="navigation" aria-label="related navigation">
  30. <h3>Navigation</h3>
  31. <ul>
  32. <li class="right" style="margin-right: 10px">
  33. <a href="../genindex.html" title="General Index"
  34. accesskey="I">index</a></li>
  35. <li class="right" >
  36. <a href="cf.FieldList.extend.html" title="cf.FieldList.extend"
  37. accesskey="N">next</a> |</li>
  38. <li class="right" >
  39. <a href="cf.FieldList.append.html" title="cf.FieldList.append"
  40. accesskey="P">previous</a> |</li>
  41. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python 1.1.10</a> &raquo;</li>
  42. <!--
  43. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python</a> &raquo;</li>
  44. <li><select onchange="location = this.options[this.selectedIndex].value;">
  45. <option value="../../1.0/index.html">1.0
  46. <option value="../../0.9.9/index.html">0.9.9
  47. <option value="../../0.9.8.3/index.html">0.9.8.3
  48. <option value="../../archive.html">Archive
  49. </select>
  50. </li>
  51. -->
  52. <li class="nav-item nav-item-0"><a href="../index.html">Documentation</a> &raquo;</li>
  53. <li class="nav-item nav-item-1"><a href="../reference.html" >Reference manual</a> &raquo;</li>
  54. <li class="nav-item nav-item-2"><a href="../class.html" >Classes of the <code class="docutils literal"><span class="pre">cf</span></code> module</a> &raquo;</li>
  55. <li class="nav-item nav-item-3"><a href="../classes/cf.FieldList.html" accesskey="U">cf.FieldList</a> &raquo;</li>
  56. </ul>
  57. </div>
  58. <div class="document">
  59. <div class="documentwrapper">
  60. <div class="bodywrapper">
  61. <div class="body" role="main">
  62. <div class="section" id="cf-fieldlist-count">
  63. <h1>cf.FieldList.count<a class="headerlink" href="#cf-fieldlist-count" title="Permalink to this headline">Âś</a></h1>
  64. <dl class="method">
  65. <dt id="cf.FieldList.count">
  66. <code class="descclassname">FieldList.</code><code class="descname">count</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="reference external" href="https://bitbucket.org/cfpython/cf-python/src/v1.1.10/cf/field.py#field.py-12406"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cf.FieldList.count" title="Permalink to this definition">Âś</a></dt>
  67. <dd><p>L.count(value) &#8211; return number of occurrences of value</p>
  68. <p>Each field in the field list is compared to <em>x</em> with the field&#8217;s
  69. <a class="reference internal" href="cf.Field.equals.html#cf.Field.equals" title="cf.Field.equals"><code class="xref py py-obj docutils literal"><span class="pre">equals</span></code></a> method (as opposed to the <code class="docutils literal"><span class="pre">==</span></code> operator).</p>
  70. <p>Note that <code class="docutils literal"><span class="pre">f.count(x)</span></code> is equivalent to <code class="docutils literal"><span class="pre">sum(g.equals(x)</span> <span class="pre">for</span> <span class="pre">g</span> <span class="pre">in</span>
  71. <span class="pre">f)</span></code>.</p>
  72. <div class="admonition seealso">
  73. <p class="first admonition-title">See also</p>
  74. <p class="last"><a class="reference internal" href="cf.Field.equals.html#cf.Field.equals" title="cf.Field.equals"><code class="xref py py-obj docutils literal"><span class="pre">cf.Field.equals</span></code></a>, <code class="xref py py-obj docutils literal"><span class="pre">list.count</span></code></p>
  75. </div>
  76. <table class="docutils field-list" frame="void" rules="none">
  77. <col class="field-name" />
  78. <col class="field-body" />
  79. <tbody valign="top">
  80. <tr class="field-odd field"><th class="field-name">Examples:</th><td class="field-body"></td>
  81. </tr>
  82. </tbody>
  83. </table>
  84. <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">cf</span><span class="o">.</span><span class="n">FieldList</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">a</span><span class="p">])</span>
  85. <span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
  86. <span class="go">2</span>
  87. <span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">b</span><span class="p">)</span>
  88. <span class="go">1</span>
  89. <span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">a</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
  90. <span class="go">0</span>
  91. </pre></div>
  92. </div>
  93. </dd></dl>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  99. <div class="sphinxsidebarwrapper">
  100. <h4>Previous topic</h4>
  101. <p class="topless"><a href="cf.FieldList.append.html"
  102. title="previous chapter">cf.FieldList.append</a></p>
  103. <h4>Next topic</h4>
  104. <p class="topless"><a href="cf.FieldList.extend.html"
  105. title="next chapter">cf.FieldList.extend</a></p>
  106. <div role="note" aria-label="source link">
  107. <h3>This Page</h3>
  108. <ul class="this-page-menu">
  109. <li><a href="../_sources/generated/cf.FieldList.count.txt"
  110. rel="nofollow">Show Source</a></li>
  111. </ul>
  112. </div>
  113. <div id="searchbox" style="display: none" role="search">
  114. <h3>Quick search</h3>
  115. <form class="search" action="../search.html" method="get">
  116. <input type="text" name="q" />
  117. <input type="submit" value="Go" />
  118. <input type="hidden" name="check_keywords" value="yes" />
  119. <input type="hidden" name="area" value="default" />
  120. </form>
  121. <p class="searchtip" style="font-size: 90%">
  122. Enter search terms or a module, class or function name.
  123. </p>
  124. </div>
  125. <script type="text/javascript">$('#searchbox').show(0);</script>
  126. </div>
  127. </div>
  128. <div class="clearer"></div>
  129. </div>
  130. <div class="related" role="navigation" aria-label="related navigation">
  131. <h3>Navigation</h3>
  132. <ul>
  133. <li class="right" style="margin-right: 10px">
  134. <a href="../genindex.html" title="General Index"
  135. >index</a></li>
  136. <li class="right" >
  137. <a href="cf.FieldList.extend.html" title="cf.FieldList.extend"
  138. >next</a> |</li>
  139. <li class="right" >
  140. <a href="cf.FieldList.append.html" title="cf.FieldList.append"
  141. >previous</a> |</li>
  142. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python 1.1.10</a> &raquo;</li>
  143. <!--
  144. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python</a> &raquo;</li>
  145. <li><select onchange="location = this.options[this.selectedIndex].value;">
  146. <option value="../../1.0/index.html">1.0
  147. <option value="../../0.9.9/index.html">0.9.9
  148. <option value="../../0.9.8.3/index.html">0.9.8.3
  149. <option value="../../archive.html">Archive
  150. </select>
  151. </li>
  152. -->
  153. <li class="nav-item nav-item-0"><a href="../index.html">Documentation</a> &raquo;</li>
  154. <li class="nav-item nav-item-1"><a href="../reference.html" >Reference manual</a> &raquo;</li>
  155. <li class="nav-item nav-item-2"><a href="../class.html" >Classes of the <code class="docutils literal"><span class="pre">cf</span></code> module</a> &raquo;</li>
  156. <li class="nav-item nav-item-3"><a href="../classes/cf.FieldList.html" >cf.FieldList</a> &raquo;</li>
  157. </ul>
  158. </div>
  159. <div class="footer" role="contentinfo">
  160. &copy; Copyright 2016, David Hassell.
  161. Last updated on Jun 23, 2016.
  162. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.5.
  163. </div>
  164. </body>
  165. </html>