    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: ACCU UK Python Users Group</title>
        <link>https://members.accu.org/index.php/journals/1177</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 14, #4 - Aug 2002</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c113/">144</a>
                    (17)
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;ACCU UK Python Users Group</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 August 2002 13:15:52 +01:00 or Sat, 03 August 2002 13:15:52 +01:00</p>
<p><strong>Summary:</strong>&nbsp;<p>The sound of one coconut shell clopping</p></p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e23" id="d0e23"></a></h2>
</div>
<p>Welcome to the Python section of C Vu.</p>
<p>Python is a relatively new programming language that has been
gathering momentum and popularity in recent years. This section of
the magazine, like the ACCU-SIG &quot;PyUK&quot; (the Python UK Users Group)
that its authors spring from, is dedicated to spreading the word,
or at least trying to point out the benefits of a surprisingly
elegant, simple and powerful language that has long outgrown its
&quot;scripting only&quot; designation.</p>
<p>Python is used in such diverse places as NASA, Industrial Light
and Magic (the Star Wars special effects people), Disney, Yahoo,
Google, Thwate, RealNetworks and even IBM. It can run on a huge
diversity of OS/hardware platforms (32 at last count, personally I
am waiting for the ZXspectrum port) and can call and be called from
Java, C and C++ code.</p>
<p>In short, Python is a object-orientated, very high level
programming language with surprisingly clear syntax, extensive
built-in data structures, strong but dynamic typing and has an
enormous number of modules and libraries covering some useful,
abstract and occasionally strange capabilities.</p>
<p>Python is sometimes characterised as everyone's favourite second
language, and I would encourage anyone involved in C, C++ and Java
systems work to look very closely at its capabilities, especially
its ability to work seamlessly with those languages. Anyway, some
background to Python and a little introduction...</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e35" id="d0e35"></a>Origins of
Python</h2>
</div>
<p>One Christmas, about a dozen years ago, a young man called Guido
van Rossum sat down and wrote an interpreter for a new language he
wanted to create as an improvement on a previous effort. This
language became Python (and yes, it was named for John Cleese and
friends). In keeping with Python's offbeat history and great
portability, it first ran on an Apple Mac.</p>
<p>Python was released from the Amsterdam laboratories where Van
Rossum worked in 1991, and has been growing in popularity ever
since. There are now an estimated 1/2 million programmers, 40+
books on Python and innumerable articles (now plus one).</p>
<p>Python is open source and free.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e44" id="d0e44"></a>The Python
community</h2>
</div>
<p>Python has a very strong community feel, centred around the
comp.lang.python newsgroup. The group is refreshingly free from
flames, egos and off-topic blathering, even though you can still
find posts on how to grow certain anatomical parts by 3 inches.
That apart, the group is a sadly rare thing these days, a relaxed,
open, collegial group that offers help, advice and support to all
from greenest newbies to the most experienced. And it is done in a
generally light-hearted tone. Just like the ACCU :-)</p>
<p>However, Python itself takes programming seriously, even if
&quot;Pythonistas&quot; do not take themselves too seriously. No, I do not
know why Python users are called Pythonistas. It's just one of
those things.</p>
<p>Python is kept alive and changing via an open process (Python
Enhancement Proposals (PEPs)) that discuss what improvements could
be made. The final decision is Van Rossums', but it is a sort of
Chinese parliament. Van Rossum and a core group of developers keep
up an impressive stream of improvements and changes that have
satisfied just about everyone, so it seems to work.</p>
<p>There are also many SIGs (including the UK Python Users Group -
an ACCU SIG) and quite a lively conference and training scene.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e55" id="d0e55"></a>Using
Python</h2>
</div>
<p>To get a copy of Python please visit <a href=
"http://www.python.org/2.2.1/" target=
"_top">www.python.org/2.2.1/</a>. This has just about everything
you want. Most of us have worked through Guido's tutorial that is
included.</p>
<p>Windows users might find the release at activestate.org more
suitable (it includes some win32 extensions that make life in
Windows much easier.</p>
<p>Automating Word and Excel has never been [so] much fun.)
Amazingly the python interpreter has also been rewritten in Java.
This means python code can be run under a JRE, allowing python code
to call and be called from Java code. If you want to play with this
try <a href="http://www.jython.org" target=
"_top">www.jython.org</a>.</p>
<p>And so just to show what Python can do, (but do not hold it
responsible for this programmer's failings) here is a piece of code
that downloads a web page, parses it and emails that day's news
headlines to the author in less than a dozen lines of code.</p>
<pre class="programlisting">
import urllib, smtplib           #Pythons vast library store is mostly text files of code added onto a path.
headlines, en, y = [], 0 , len('&lt;B class=&quot;h1&quot;&gt;') #setup a list to store headlines, and a couple of useful bits

htmlFile = urllib.urlopen('http://news.bbc.co.uk').read() #visit the BBC site and get the html as a single string

while 1:                                        #an infinite loop (break condition lower down)
    st = htmlFile.find('&lt;B class=&quot;h1&quot;&gt;',en)     #find beginning of each headline
    en = htmlFile.find('&lt;/B&gt;', st)              #find end of each headline
    if st == -1: break                          #if no more headlines stop
    headlines.append( htmlFile[st + y:en] )     #slice up the html string at the start and end of the headline,
s = smtplib.SMTP('post.myServer.co.uk')         #open up a connection to smtp server
s.sendmail('Python@myServer.co.uk',             #send the message (From, to and body, using string formatting)
           'pbrian@myServer.co.uk',
           'Subject:Daily News\r\n\r\nThe headlines are:\n %s \n %s \n %s' %
           (headlines[0],headlines[1],headlines[2]) )
s.quit()
</pre>
<p>The first thing you probably notice is the lack of braces or
brackets. Whitespace and indentation are actually part of the
syntax in Python. After a while it becomes natural - honestly, try
it for a few hours. Eric Raymond's comments on this follow most of
our own experiences (see below).</p>
<p>The first line imports some helper libraries. There is a plain
text file on my machine called urllib.py. I can open it and read
the python code. It uses some clever socket manipulation to run
HTTP to the BBC site and get me my news page. That library is part
of the standard distribution. Python gets referred to as &quot;batteries
included&quot;. This is why.</p>
<p>Where are the type declarations? Well, Python discovers type at
run-time, meaning there is strong typing (you cannot conjoin
integer 12 and string &quot;3&quot; to get 15 (or 123), but it is dynamic,
allowing less lines, less breaks in the flow. I like it.</p>
<p>And finally the data structures - lists are simple to set up and
easy to manipulate. Dictionaries or associative arrays are just as
easy (they use curly brackets not square) and they can hold
anything. A dictionary containing a list of strings, dictionaries
and other lists is easy. Pointless, perhaps, but easy.</p>
<p>Python can stretch from a 10 line throwaway to hundreds of
thousands of lines of code, run on a huge variety of platforms,
interact with a huge variety of other software whilst still
retaining clear, readable and straight-forward code. This deserves
an explanation. My best attempt is that Python takes programming
seriously. This means that it is not designed for a given
application domain, nor built with an eye on 30 years of backwards
compatibility or the marketing needs of a multinational.</p>
<p>I have read that &quot;Python gets its compromises right&quot;. I think it
does too. Give it a try: you might like it :-)</p>
<p>Enjoy!</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e88" id="d0e88"></a>Useful
URLS</h2>
</div>
<p>&quot;Official&quot; Distribution: <a href="http://www.python.org/2.2.1"
target="_top">http://www.python.org/2.2.1</a></p>
<p>Windows, with COM access: <a href=
"http://activestate.com/Products/Download/Get.plex?id=ActivePython"
target=
"_top">http://activestate.com/Products/Download/Get.plex?id=ActivePython</a></p>
<p>Tutorial: <a href=
"http://www.python.org/doc/current/tut/tut.html" target=
"_top">http://www.python.org/doc/current/tut/tut.html</a></p>
<p>Origins of Python: <a href=
"http://www.python.org/doc/essays/foreword.html" target=
"_top">http://www.python.org/doc/essays/foreword.html</a></p>
<p>PEPs: <a href="http://www.python.org/peps/" target=
"_top">http://www.python.org/peps/</a></p>
<p>Jython - using Python and Java: <a href="http://www.jython.org/"
target="_top">http://www.jython.org/</a></p>
<p>SWIG - using C, C++ and Python: <a href="http://www.swig.org/"
target="_top">http://www.swig.org/</a></p>
<p>Introductory Articles: <a href=
"http://www.python.org/doc/Intros.html" target=
"_top">http://www.python.org/doc/Intros.html</a></p>
<p>Interesting comments from Eric S Raymond: <a href=
"http://www.linuxjournal.com/article.php?sid=3882" target=
"_top">http://www.linuxjournal.com/article.php?sid=3882</a>,
<a href="http://europython.zope.nl/interviews/entries/eric_raymond"
target=
"_top">http://europython.zope.nl/interviews/entries/eric_raymond</a></p>
<p>Comparisons to other languages: <a href=
"http://www.ipd.uka.de/~prechelt/Biblio/jccpprtTR.pdf" target=
"_top">http://www.ipd.uka.de/~prechelt/Biblio/jccpprtTR.pdf</a>,
<a href="http://home.pacbell.net/ouster/scripting.html" target=
"_top">http://home.pacbell.net/ouster/scripting.html</a></p>
<p>Number of programmers: <a href=
"http://www.activestate.com/Corporate/Communications/Releases/Press957675912.html"
target=
"_top">http://www.activestate.com/Corporate/Communications/Releases/Press957675912.html</a></p>
<p>Who else uses Python: <a href=
"http://www.python.org/psa/Users.html" target=
"_top">http://www.python.org/psa/Users.html</a></p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
