Humor: The Evolution of a Programmer

Price, Erik eprice at ptc.com
Wed Nov 13 13:22:57 EST 2002


> -----Original Message-----
> From: pll at lanminds.com [mailto:pll at lanminds.com]
> Sent: Wednesday, November 13, 2002 12:37 PM
> To: Price, Erik
> Cc: Bill Sconce; discuss at gnhlug.org
> Subject: Re: Humor: The Evolution of a Programmer 
> 
> 
> 
> While I agree that Perl's OO features were an afterthought and 
> therefore, probably not as clean as they [c,sh]ould be, it does have 
> a fantastic debugger which sounds the same as Python's interactive 
> interpreter.  I don't know much about Python, but I assume the 
> 'interactive' feature allows you to set break points, watch variables 
> and arrays, etc.?

Well, the Python interactive interpreter is not really a debugger,
though I'm sure it's used that way.  As for whether or not you can
set break points etc, I am not sure but I kind of doubt it.

The Python interpreter is more like a shell than anything else.
It's not designed to let you iterate through an existing script
and see how it's doing.  You can, however, import an existing
Python script (presuming you have followed good design practices
and written your script so that it is also a useful module for
import into other scripts), and all of the objects and definitions
in that script are made available to the environment.

I find that I use the interactive Python shell more for testing
snippets and theories quickly than actually composing entire
scripts.  It's like, I'll be composing a Python script in a text
editor and I'll say "man I wish I could isolate this function and
these two class definitions and see what happens if I instantiate
an object of each class and pass them as parameters to the
function..." -- well, that's super easy, I just pop into the shell
and do it.  I can even copy and paste the definitions into the
shell since the shell accepts literal Python code, not some special
syntax.

In fact, you could in theory just live in the Python interactive
shell and do all of your work from there!  Of course, you'd be
neglecting the years of utilities built into shells like "bash"
that are more appropriate for using a computer, but it could be
done.  Want to read a file?  You could just open it and iterate
over the lines with the file pointer object.  Want to browse the
web?  Open a socket to a remote web host and make a HTTP request.

> The thing I really like about perl is it's ease of use on the command 
> line.  I can easily do things like:
> 
> 	perl -de 'print;'
> 
> and then have the entire feature set of the interpreter at my 
> disposal.  I often use this to test code snippets I'm not completely 
> sure about before attempting to debug a larger program.

This is exactly how I use the Python interactive shell -- except
that, unlike one-liners, the interactive shell remembers all of
my previous code, so that if I define a function and then 200 lines
later I want to use it, it's still there.  Also, you don't have
to constrain everything to one-liners.

BUT ... in defense of Perl, which I use very often ... if I really
need a one-liner, it is my first choice.  I don't think Python
even has a "-e" equivalent, though it might.  I wouldn't use it
if it did, because it's too verbose and depends on line endings
for delimiting blocks of code.  Perl is really the master of quick
one-line utilities.  (Although I've been frustrated lately on this
Solaris box at work because it doesn't line wrap as nicely as does
Linux, at least in my experience... I end up overwriting the prev
line sometimes.)

> >I really like it, I just wish there was a truly portable graphics 
> >library (as in, "installed by default on all systems").  I have 
> >been meaning to try out Jython, for that matter....
> 
> This is one of the things that's nice about perl, there are 
> interfaces to Tk, gtk, etc. that have all been ported.
> I haven't used them, but I know they exist.

The resources available to a Perl programmer are immense.  While I 
would still prefer Python for a complex program, in Perl chances 
are someone has already done most of what I need done.  And like 
you said, there are tons of graphics libs and other supporting
technologies.


Erik



More information about the gnhlug-discuss mailing list