User:Jorend/Python set usage: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "=Abstract= A <code>Set()</code> constructor is proposed for a future edition of the ECMAScript programming language standard. Should the constructor take a single iterable argum...")
 
No edit summary
Line 17: Line 17:
=Methodology=
=Methodology=


A copy of CPython was obtained using the Mercurial command <code>hg clone http://hg.python.org/cpython</code>. The script below was run in the resulting <code>cpython</code> directory.
A copy of the Python standard library and a corresponding Python executable were obtained using the commands:


The script finds each set-creation expression. It disregards the expression <code>set()</code> which creates an empty set. The rest it classifies as either
hg clone http://hg.python.org/cpython
cd cpython
./configure
make
 
(<code>hg</code> is [http://mercurial.selenic.com/ Mercurial]; it can be installed on most Linux systems using something like <code>sudo apt-get install mercurial</code>.)
 
(On Mac OS X Lion, configure with <code>CC=gcc-apple-4.2 ./configure</code> instead. Apple’s LLVM-based gcc that ships with Lion can’t build Python.)
 
The script below was then run in the same directory. The script searches the <code>Lib</code> directory for Python files. It disregards unit tests, as they typically contain very unusual code. It parses each other file using the Python parser and finds each set-creation expression. The expression <code>set()</code>, which creates an empty set, is disregarded; the rest are classified as one of the following:


* A - statically known number of values (supporting variable arguments)
* A - statically known number of values (supporting variable arguments)
Line 73: Line 82:
   
   
  main()
  main()
= Results =
638

edits

Navigation menu