Programmer-Wanna-Be (Is Python for me?)

Alex Martelli aleaxit at yahoo.com
Wed Oct 11 18:31:10 EDT 2000


<fifeclub at my-deja.com> wrote in message news:8s2354$ep2$1 at nnrp1.deja.com...
> I am "pre-beginner".  I'm probably at the start of a very long journey.

Welcome to join us, and, enjoy the trip!

> Basically, I want to learn how to create relatively simple Windows
> Applications (although I'm not against "exporting" to other OS's).  So I
> did some quick research and found that many programming languages existed
> for this purpose.

Oh yes.  LOTS of them.  My compliments for finding Python, a
real jewel among the rather mixed-bag of languages; you seem
to have a really good eye for these things.

> So now I'm trying to decide which language is best for me.  I'm doing my
> research on which language to learn by reading the newsgroups postings
> and Python seems to be among my front-runners.  First let me say that I'm
> looking for a (relatively) EASY-TO-LEARN language with which I can also
> learn programming in general.  But I also want to be able to do more as

Very reasonable.  Python is the easiest-to-learn complete language
I have ever met in 25 years of working with computers -- yet, it's
SO powerful, that it's my programming language of choice for most
everyday tasks (not for all of them; but, by far, for most)... I only
really found out about it a bit more than a year ago, but found myself
becoming productive in it faster than with any other of the dozens
of languages I had tried over the years.

> I become more experienced. I have considerable experience hand-coding
> HTML (using notepad only on my Windows 98 platform), but I have no true
> programming experience.  Despite my aversion to WYSIWYG HTML-editors
> such as Frontpage, I beleive that any help I can get in programming more
> complex GUI Windows applications would be a blessing.

There are basically two parts to "programming a complex GUI application",
just like there are for a Dynamic-HTML page: the GUI itself, and the code
behind it (Javascript or Vbscript, typically, being the code behing a DHTML
page).  The latter gives the page/program its actual "behavior" -- what
*happens* around/about it -- while the former determines its "look",
what the end-user sees.

Of course, the typical ratio is different.  A normal/usual/typical DHTML
page
may have about 10-20% code (scripting) and 80-90% HTML (and images
&c), while for a complex application the typical ratios might well be
reversed (10-20% of it, at most, being about "presentation", while by
far most of the effort goes into "behavior").  Of course, the scale is a
continuum -- that's why there are "HTML behaviors", "HTML applications",
and so-called-'true'-applications that are in fact by-far-mostly-GUI with
very little "business logic" behind it.

Anyway, most of the "help" you will find on the market focuses on the
GUI -- there is still, relatively, very little that really helps you express
your intended logic... except a good programming language and the
tools around it (a good/smart editor, browser, debugger...).  The code
quality generated by semi-automatic GUI tools is, alas, on a par with
the HTML quality generated by Frontpage.

Fortunately, if you already know how to write Dynamic HTML, this
may be all you need for the GUI part of most applications -- and you
can choose to write the HTML (and controls embedded therein, etc)
in any way you choose (by hand, with Frontpage, or with some
intermediate-level help -- Arachnophilia [one of my favourite tools],
Firstpage, Homesite, Visual Interdev, whatever).  Your GUI code just
needs to arrange for the right pages/forms to be shown by the browser,
and to respond to the "HTML Events" that are generated (including
those that may be generated by embedded controls, etc).  I find this
a rather pleasing way to develop, and Python+Internet Explorer a
great platform for it.

But, of course, you have alternatives -- there are several GUI kits
that you can use with Python, each with some special strengths.
I think that the GUI issue is the least of your worries.


> NowI've got many questions for all of you who use Python.  (And please
> dumb things down to my current "non-programmer" level of comprehension!)
>
> 1.  First of all, is Python what I'm looking for:  a way to create
> Windows (or other OS's) applications?

Yes, it can well be used for this purpose (and for others as well,
such as driving/controlling/integrating existing applications and
components; Python is great at the specific task of reusing any
kind of existing code -- for example, I've already mentioned how
well it does at driving/controlling Internet Explorer if you have
some HTML [for example -- IE can show other stuff too...] to
show and with which to dynamically handle user interaction; many
Office or simil-Office pieces also often come in handy, etc...).

> 2.  Is Python RELATIVELY one of the easiest ways to do this?

Oh yes.  With other languages you may perhaps more easily
get some tools that will write empty 'skeletons' of applications
for you, but that is the easy/relatively uninteresting part --
then comes the REAL task, i.e., expressing the logic and
behavior you desire, and then it's down to you, your chosen
programming language, and your editor/debugger... and
there Python (and its supporting cast of tools) *shine*.  Its
"syntax" (the rules regarding what you write in the language)
and "semantics" (the "meaning", or "effect", of what you have
written) are outstanding in simplicity and cleanliness.  This
simplicity gives both ease, and power...

> 3.  What about Visual Basic? (the most commonly used) Why should I not
> choose VB instead?

VB is OK if all you have to write is GUI, or almost -- if applications
that have very little 'substance' are more or less the limit of your
interests.  In this case, you will maximize your use of its strengths
(basically, the supporting 'wysiwyg'-like editors, its integration
right into Office, &c) and minimize your contact with its weakness --
i.e., the Visual Basic language itself, which is a *mess*.

MS has more or less silently conceded the latter point by promising
a total (and probably incompatible) rewrite of VB for next release
(don't hold your breath waiting for it, but, it will come).  Whether
they do a better job of it next time around remains to be seen
(they probably will -- it would be harder to do a _worse_ one:-).

The root problem with VB, as a language, is that it's grown up
haphazardly, basically a ramshackle collection of ad-hoc fixes to
perceived problems, building on top of each other.  There's a lot
of stuff in there now, so it's by no means easy to really learn
and understand all of it, although once you _have_ learned it
is possible to do *almost* as much as in a real language (such
as Python); but the learning basically has to proceed by rote
and memorization, since there is no discernible "master plan",
no underlying "rules of engagement" for your mind to distill and
digest... just a collection of exceptions:-).  I think that to get to
a "reasonable mastery" level will take about twice as much as
with, say, Python (and you'll be able to do a bit less once you
are at that level) -- the ratio may differ, depending on your own
ways of thinking and seeing the world (if you're good at seeing
and discerning 'regular patterns', even just subconsciously, then
VB becomes harder, because the continuous flow of exceptions
trips you up more, while Python becomes easier, because it has
very consistent underpinnings; for me, it was closer to 4-to-1,
since I'm *very* inclined to 'seeing patterns'...).


> 4.  Is there a WYSIWYG editor (like Frontpage is for HTML)?  Is this what
> Tkinter is?  Is there a 'better' WYSIWYG editor for Python that I should
> use instead?

My favourite editors for Python are:
a. the one that comes with IDLE (part of Python itself, in the
    standard download)
b. the one that comes with PythonWin (part of the win32all
    Windows extensions to Python, and also of the ActiveState
    build of Python -- the latter comes _without_ IDLE)
c. gvim, but that's because I'm somewhat weird (VI and its
    relatives are soundly hated by most editor-users and deeply
    loved by a small but vocal minority of us, see www.vim.org)

These are all powerful text-editors (each leaving notepad in
the dust -- but that's easy!-), giving you such help as 'coloring'
your code appropriately as you write it, and what MS calls
"intellisense" in some cases (open a box of choices at some
points in your typing, or at least a context-sensitive tip -- but
it must be admitted that no tool, for any other language, does
it as well as MS's VB editor [not even other MS tools]).

For the layout of your GUI's, it depend on what GUI kit you
choose.  I've already mentioned HTML, for which I'm sure you
are familiar with the wide variety of tools available.  If you
choose wxPython (another good choice), then a tool called
"Boa Constructor" (still in its infancy, but already very useful)
is quite good.  Etc, etc.  The spectrum is even wider if you're
ready to pay, as I guess you must be since VB is quite pricey
(just about everything about Python is free...).

Tkinter is just one of the many GUI kits -- it holds a special
place because it's very portable (Windows, Mac, Unix, Linux,
and more), has been around a long time, and IDLE is built
on top of it (but you do not _need_ to know anything of Tk
to use IDLE!-).  Personally, I'm not very keen on it (and I
think there is currently no wysiwyg-GUI-builder for it), but
many love and use it.

> 5.  What's the deal with Tk/Tcl?  Why is this so closely tied with Python
> and Tkinter if Python is it's own language?  (The install instructions
> say I may need to install Tk/Tcl too (what ever that is))

The Tkinter package interfaces Python to Tk, a GUI kit that
was originally built for Tcl (another scripting language) and
still needs to carry it around.  However, for Windows, no
problems with any recent Python version...:

a. the official Python distribution carries Tcl/Tk around with
    it and implicitly and automatically installs it (so you can
    use IDLE, for example)

b. the ActiveState version does not include Tkinter (nor
    Tcl/Tk, nor IDLE) but relies entirely on Windows-only
    stuff (PythonWin and friends).

I suggest the official Python distribution, with win32all added
to it, because IDLE is _so_ nice (and I would not know how to
easily add it if one started with ActiveState...) -- and you may
want to have Tkinter around, even if you choose something
else as your main GUI kit (HTML, or wxPython that needs to
be downloaded and installed separately after Python, say), to
try it out, to run scripts you may receive or download that
use it, etc, etc.

> 6.  Where should I start?  (I've already downloaded and installed
> Python2.0b2 but haven't attempted to write anything)  Do I need to
> download anything else?

2.0b2 is a beta version (that's what the b is for); there is now a
"release candidate" (2.0c1); final release will no doubt come very
soon, and you should download it, uninstall the beta, and install
the final-release, when it does come.  (But you're unlikely to hit
on a known-bug meanwhile, so you CAN already start...!).

With the standard-release, be it beta or definitive, you can start
learning the full Python language and standard libraries, but if
you want to do GUI's, then Tkinter is all you have for that.  I
think that a short spell of concentrating on the language, before
moving on to GUIs and whatever, would be a good idea, so,
for now, you may not need to download anything more; later,
I strongly suggest win32all (but don't rush to download build
134 right now -- there will no doubt soon be another build to
fix a small but important bug...) -- basically because it enables
COM, which I see as the main way for Python to interact with
the system under Windows (e.g., for the DHMTL I earlier
recommended, you do need COM, and thus, win32all!-).

Then, you need a good tutorial.  Guido's, that comes with
Python's docs, IS good, but oriented to teaching Python to
somebody who already knows something about how to
program (in other languages), so I would not recommend
it as a first-tutorial for you.  Rather, there are several other
good ones on the net -- e.g., "How to think like a computer
scientist", by Downey, Elkner, and Zadka, at
http://yhslug.tux.org/obp/thinkCS/thinkCSpy
(that link seems to be down right now -- can anybody
suggest a mirror/etc...?).


Alex






More information about the Python-list mailing list