Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Off topic] Software epigrams

107 views
Skip to first unread message

Steven D'Aprano

unread,
May 13, 2013, 5:20:09 AM5/13/13
to
My, it's been a long time since I've seen these:

http://pu.inf.uni-tuebingen.de/users/klaeren/epigrams.html

They pre-date the Zen of Python by at least a decade, and quite frankly I
think many of them miss the mark. But whether you agree or disagree with
them, they're worth reading.



--
Steven

mar...@python.net

unread,
May 13, 2013, 10:56:39 AM5/13/13
to pytho...@python.org
Yes, they're all over the place, but worth reading. My favorite is:

101: Dealing with failure is easy: Work hard to improve. Success is also
easy to handle: You've solved the wrong problem. Work hard to improve.

Chris Angelico

unread,
May 13, 2013, 1:47:28 PM5/13/13
to pytho...@python.org
8. A programming language is low level when its programs require
attention to the irrelevant.

So much a matter of debate. Indentation is irrelevant, why should
Python programs pay attention to it? Block delimiters are irrelevant
too, the interpreter should be able to figure them out from the code
layout. But this one is absolutely right:

16. Every program has (at least) two purposes: the one for which it
was written and another for which it wasn't.

48. The best book on programming for the layman is "Alice in
Wonderland"; but that's because it's the best book on anything for the
layman.

LGTM.

ChrisA

Skip Montanaro

unread,
May 13, 2013, 2:02:42 PM5/13/13
to Chris Angelico, pytho...@python.org
> 8. A programming language is low level when its programs require
> attention to the irrelevant.
>
> So much a matter of debate. Indentation is irrelevant, why should
> Python programs pay attention to it? Block delimiters are irrelevant
> too, the interpreter should be able to figure them out from the code
> layout. But this one is absolutely right:

I think "irrelevant" in this context means stuff like memory management.

My fave was #7: "It is easier to write an incorrect program than
understand a correct one," which explains in large part why the wheel
is so often reinvented...

Skip

Chris Angelico

unread,
May 13, 2013, 2:12:53 PM5/13/13
to pytho...@python.org
On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro <sk...@pobox.com> wrote:
>> 8. A programming language is low level when its programs require
>> attention to the irrelevant.
>>
>> So much a matter of debate. Indentation is irrelevant, why should
>> Python programs pay attention to it? Block delimiters are irrelevant
>> too, the interpreter should be able to figure them out from the code
>> layout. But this one is absolutely right:
>
> I think "irrelevant" in this context means stuff like memory management.

Sure. That one's pretty clear (if you care about memory management,
you want a low level language). But there's still plenty that are less
clear. Though in generalities, I think I agree; paying attention to
minutiae is the consequence of taking a lower-level language. It's
just that the difference between relevant and irrelevant is hard to
define.

ChrisA

Neil Cerutti

unread,
May 13, 2013, 2:42:28 PM5/13/13
to
On 2013-05-13, Skip Montanaro <sk...@pobox.com> wrote:
>> 8. A programming language is low level when its programs
>> require attention to the irrelevant.
>>
>> So much a matter of debate. Indentation is irrelevant, why
>> should Python programs pay attention to it? Block delimiters
>> are irrelevant too, the interpreter should be able to figure
>> them out from the code layout. But this one is absolutely
>> right:
>
> I think "irrelevant" in this context means stuff like memory
> management.

I thought I liked that one at first, but upon reflection it
speciously inserts the word "irrelevant" in order to avoid
stating a tautology: A programming language is low level when its
programs require attention to low level details.

--
Neil Cerutti

Fábio Santos

unread,
May 13, 2013, 4:49:23 PM5/13/13
to Neil Cerutti, pytho...@python.org

> --
> http://mail.python.org/mailman/listinfo/python-list

It's not a tautology in disguise. Irrelevant != low level. When low level details are relevant to the scope of my program, I use a low level language.

Dan Sommers

unread,
May 13, 2013, 11:08:01 PM5/13/13
to
On Tue, 14 May 2013 04:12:53 +1000, Chris Angelico wrote:

> On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro <sk...@pobox.com> wrote:

>>> 8. A programming language is low level when its programs require
>>> attention to the irrelevant.

>> I think "irrelevant" in this context means stuff like memory
>> management.

> Sure. That one's pretty clear (if you care about memory management,
> you want a low level language) ...

http://www.memorymanagement.org/articles/lang.html says:

C programmers think memory management is too important to be
left to the computer. Lisp programmers think memory management
is too important to be left to the user.

(from Ellis and Stroustrup's The Annotated C++ Reference Manual)

> ... It's just that the difference between relevant and irrelevant is
> hard to define.

And if I've designed my program the right way, what's relevant in one
place (package, module, function, line of code) is different from what's
relevant in another.

Dan

Chris Angelico

unread,
May 13, 2013, 11:28:26 PM5/13/13
to pytho...@python.org
On Tue, May 14, 2013 at 1:08 PM, Dan Sommers <d...@tombstonezero.net> wrote:
> And if I've designed my program the right way, what's relevant in one
> place (package, module, function, line of code) is different from what's
> relevant in another.

Absolutely. Layered systems FTW! Nothing matters but your current
layer and those it touches.

ChrisA

Neil Cerutti

unread,
May 15, 2013, 1:24:29 PM5/15/13
to
It is a tautology is disguise. When you use a low level language,
low level details are relevant to the scope of your program.

--
Neil Cerutti

Fábio Santos

unread,
May 15, 2013, 1:49:34 PM5/15/13
to Neil Cerutti, pytho...@python.org


On 15 May 2013 18:29, "Neil Cerutti" <ne...@norwich.edu> wrote:
>
> On 2013-05-13, F?bio Santos <fabiosa...@gmail.com> wrote:
> >
> > On 13 May 2013 19:48, "Neil Cerutti" <ne...@norwich.edu> wrote:
> >>
> >> On 2013-05-13, Skip Montanaro <sk...@pobox.com> wrote:
> >> >> 8. A programming language is low level when its programs
> >> >> require attention to the irrelevant.
> >> >>

(...)

> > It's not a tautology in disguise. Irrelevant != low level. When
> > low level details are relevant to the scope of my program, I
> > use a low level language.
>
> It is a tautology is disguise. When you use a low level language,
> low level details are relevant to the scope of your program.
>
> --
> Neil Cerutti

> --
> http://mail.python.org/mailman/listinfo/python-list

I don't see it that way. I think relevance and level are two unrelated concepts.

For example, in python you are handling irrelevant things if you are trying to start a program and redirecting its standard output into another program's standard input instead of just using the shell and a pipe to do it.

And in C you are just at the right level to write something for a microchip, but then again you are doing a load of irrelevant stuff if you need to work numbers larger than the maximum permitted.

Neil Cerutti

unread,
May 15, 2013, 2:27:39 PM5/15/13
to
On 2013-05-15, F?bio Santos <fabiosa...@gmail.com> wrote:
>> It is a tautology is disguise. When you use a low level
>> language, low level details are relevant to the scope of your
>> program.
>
> I don't see it that way. I think relevance and level are two
> unrelated concepts.
>
> For example, in python you are handling irrelevant things if
> you are trying to start a program and redirecting its standard
> output into another program's standard input instead of just
> using the shell and a pipe to do it.
>
> And in C you are just at the right level to write something for
> a microchip, but then again you are doing a load of irrelevant
> stuff if you need to work numbers larger than the maximum
> permitted.

If you need numbers larger than the maximum permitted then all
the code you write to handle them is relevant.

If I want to bake bread I hope I don't have to till a garden,
plant the wheat, harvest the wheat, and grind the wheat. But
gardening is relevant to bread baking weather or not I do it.

--
Neil Cerutti

inq1ltd

unread,
May 15, 2013, 4:56:01 PM5/15/13
to pytho...@python.org

My web server is using python 2.5.

 

My cgi file is trying to open a shelve.

 

I xxx out some of the path below.

 

I am trying to find out if this

error is caused because I am using python 2.7 to write

the cgi file and my web server is using python 2.5.

 

I would appreciate a confirmation of this.

 

line 85, in FentriesFilled dbase = shelve.open( vpath, 'c' ) File "/usr/local/lib/python-2.5/lib/python2.5/shelve.py", line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "/usr/local/lib/python-2.5/lib/python2.5/shelve.py",

 

line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File "/usr/local/lib/python-2.5/lib/python2.5/anydbm.py", line 83, in open return mod.open(file, flag, mode)

 

File "/usr/local/lib/python-2.5/lib/python2.5/dbhash.py", line 16, in open return bsddb.hashopen(file, flag, mode)

 

File "/usr/local/lib/python-2.5/lib/python2.5/bsddb/__init__.py", line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) bsddb.db.DBInvalidArgError: (22, 'Invalid argument --/home/users/web/xxxxx/yyy.inqvista/public_html/xxxx-ssss/email: unsupported hash version: 9')

 

thanks,

jd

 

 

 

 

Fábio Santos

unread,
May 15, 2013, 8:21:52 PM5/15/13
to Neil Cerutti, pytho...@python.org

> --
> http://mail.python.org/mailman/listinfo/python-list

Then memory management t is relevant to every python program even though it's done by the interpreter?

And in Java we have factories, builders and builderfactories. What's so relevant about them? Java is high level, no?

rusi

unread,
May 15, 2013, 11:55:01 PM5/15/13
to
On May 14, 8:08 am, Dan Sommers <d...@tombstonezero.net> wrote:
> On Tue, 14 May 2013 04:12:53 +1000, Chris Angelico wrote:
> > On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro <s...@pobox.com> wrote:
> >>> 8. A programming language is low level when its programs require
> >>> attention to the irrelevant.
> >> I think "irrelevant" in this context means stuff like memory
> >> management.
> > Sure. That one's pretty clear (if you care about memory management,
> > you want a low level language) ...
>
> http://www.memorymanagement.org/articles/lang.htmlsays:
>
>     C programmers think memory management is too important to be
>     left to the computer. Lisp programmers think memory management
>     is too important to be left to the user.
>
>     (from Ellis and Stroustrup's The Annotated C++ Reference Manual)

Notable physicist David Bohm wrote that the difficulty in
understanding quantum physics is largely a result of the limitation of
the subject-predicate format of Indo-European languages.

He suggested some experiments in languaging called rheomode that makes
English more process-oriented and less (abstract)noun oriented.

One part of this project is to learn to use the word 'relevate' --
which is 'relevant' verbified with an element of 'elevate' as in 'lift
into relief'

I guess the Ellis and Stroupstrup quote above just shows that C++
programmers relevate in one direction whereas Lisp programmers
relevate in another.

More http://www.mindstructures.com/2010/04/meaning-and-context/

Twenty two years ago I wrote about this http://www.the-magus.in/Publications/chor.pdf

Suddenly I am finding glowing references to this
http://dieswaytoofast.blogspot.in/2013/01/why-i-grown-to-loathe-c.html

And I am uneasy because these questions are far less rhetorical/
tautological than I imagines in 1990!

So here's a (rather incomplete/preliminary) rebuttal to myself
http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html

Neil Cerutti

unread,
May 16, 2013, 10:23:28 AM5/16/13
to
On 2013-05-16, F?bio Santos <fabiosa...@gmail.com> wrote:
>> If I want to bake bread I hope I don't have to till a garden,
>> plant the wheat, harvest the wheat, and grind the wheat. But
>> gardening is relevant to bread baking weather or not I do it.
>
> Then memory management t is relevant to every python program
> even though it's done by the interpreter?

Yes, I think so. If you didn't understand how Python managed
memory, you couldn't write it effectively. You would end up
making unecessary copies, and other pathological programming
practices.

> And in Java we have factories, builders and builderfactories.
> What's so relevant about them? Java is high level, no?

When I tried to pin down what an irrelevant detail in a computer
program could be, I couldn't do it. I guess comment decorations,
maybe? But those would have no bearing on the level of problem
for which a programming language is most appropriate.

--
Neil Cerutti

Chris Angelico

unread,
May 16, 2013, 10:37:31 AM5/16/13
to pytho...@python.org
Let me give you a real example.

One of the programs I wrote at work is a simple daemon that runs on
every node in a network. It periodically sends out a heartbeat signal
that the other nodes hear, and if any node hasn't been heard from in X
seconds, it is deemed "down". (It might technically not be down, if
there's a network problem, but the point is that we don't care about
the difference. It's down.) There's also some incidental statussy data
included, for convenience. This is implemented using UDP.

Do I care about how a UDP packet is structured? No.

Do I care about the mechanics of IP routing? No.

Do I care about MAC addresses? No. They might feature in our IPv6
addresses, but I still don't care - the IP addresses (v4 or v6) of the
nodes are treated as opaque tokens.

All I care about is that I call a function with a string of data and a
corresponding function gets called in the other program with that same
string. All the details of how that happens in between aren't
important to my program. They're somewhat of note in the design phase,
but not to the program itself. They are, in fact, irrelevant.

ChrisA

rusi

unread,
May 16, 2013, 11:06:10 AM5/16/13
to
On May 16, 7:37 pm, Chris Angelico <ros...@gmail.com> wrote:
> On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti <ne...@norwich.edu> wrote:
You are just saying (in specific detail) what I said, viz that the
programmer is one who 'relevates' ie sifts the relevant from the
irrelevant and a good programming language is one that gives good
relevating tools:
http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html

Chris Angelico

unread,
May 16, 2013, 11:19:38 AM5/16/13
to pytho...@python.org
On Fri, May 17, 2013 at 1:06 AM, rusi <rusto...@gmail.com> wrote:
> On May 16, 7:37 pm, Chris Angelico <ros...@gmail.com> wrote:
>> On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti <ne...@norwich.edu> wrote:
>> > When I tried to pin down what an irrelevant detail in a computer
>> > program could be, I couldn't do it. I guess comment decorations,
>> > maybe? But those would have no bearing on the level of problem
>> > for which a programming language is most appropriate.
>>
>> Let me give you a real example.
>> [snip]
>
> You are just saying (in specific detail) what I said, viz that the
> programmer is one who 'relevates' ie sifts the relevant from the
> irrelevant and a good programming language is one that gives good
> relevating tools:
> http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html

Right. All I'm adding is a concrete example - which, I think, will be
helpful to Neil, and perhaps to others too.

ChrisA

Jean-Michel Pichavant

unread,
May 16, 2013, 1:17:57 PM5/16/13
to inq1ltd, pytho...@python.org

----- Original Message -----

>I am using python 2.7 to write
> the cgi file and my web server is using python 2.5.

The answer lies in your question.

JM


-- IMPORTANT NOTICE:

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

inq1ltd

unread,
May 16, 2013, 5:21:04 PM5/16/13
to Jean-Michel Pichavant, pytho...@python.org

On Thursday, May 16, 2013 07:17:57 PM Jean-Michel Pichavant wrote:

> ----- Original Message -----

>

> >I am using python 2.7 to write

> >

> > the cgi file and my web server is using python 2.5.

>

> The answer lies in your question.

>

> JM

>

 

I appreciate the response,

 

However, My question was wrong.

 

The traceback I got

couldn't be because of a difference in versions

because I programmed the cgi on the site.

 

I found that the path to the cgi had to be complete,

something like this:

 

/home/users/web/xxx/yyy.inqvista/public_html/home/read/mail

 

anything else gets a traceback.

 

jd

 

 

 

 

 

 

 

 

 

 

 

inq1ltd

unread,
May 30, 2013, 3:48:20 PM5/30/13
to pytho...@python.org

python help,

 

I've tried this code which I got from:

http://www.tutorialspoint.com/python/python_sending_email.htm

 

 

I build this file and run it

---//---

 

#!/usr/bin/python

import smtplib

sender = "inq...@inqvista.com"

receivers = ["webm...@inqvista.com"]

 

message = """From: jol

To: webmaster

Subject: SMTP e-mail test

 

This is a test e-mail message.

"""

 

try:

smtpObj = smtplib.SMTP('localhost')

smtpObj.sendmail(sender, receivers, message)

print "Successfully sent email"

except SMTPException:

print "Error: unable to send email"

 

--//--

 

After running the the file and I get

"Successfully sent email"

 

My question is why doesn't webmaster get an email?

 

jol

 

 

 

 

 

 

 

 

 

 

Chris Angelico

unread,
May 30, 2013, 6:13:53 PM5/30/13
to pytho...@python.org
On Fri, May 31, 2013 at 5:48 AM, inq1ltd <inq...@inqvista.com> wrote:
> python help,
>
> I've tried this code which I got from:
>
> http://www.tutorialspoint.com/python/python_sending_email.htm
>
> I build this file and run it
>
> After running the the file and I get
>
> "Successfully sent email"
>
> My question is why doesn't webmaster get an email?

First point: Please send *plain text* emails. Your message came out
double-spaced and with absolutely no indentation, which destroys the
structure of Python code. (Your script is sufficiently simple that
it's fairly clear how it had to be laid out, but when you force us to
use our crystal balls for simple stuff like indentation, we can't use
them again for something more important. The cooldown on these babies
is pretty stiff sometimes.)

Secondly, it helps a LOT to tell us what you're running under - Python
version, OS, etc. One easy way to do that is to quote the text that
the interactive interpreter opens with, eg:

Python 2.4.5 (#1, Jul 22 2011, 02:01:04)
[GCC 4.1.1] on mingw32

Python 3.4.0a0 (default:5dcd7ee0716a, Mar 30 2013, 08:17:06)
[GCC 4.7.2] on linux

Now, on to your actual code.

The docs say:
"""This method will return normally if the mail is accepted for at
least one recipient. Otherwise it will raise an exception. That is, if
this method does not raise an exception, then someone should get your
mail."""

That's nice confidence-inducing language, but I take exception (if
you'll pardon the pun) to the last part. The only thing this function
can know is that the mail has been accepted by the next hop. After
that... well, the internet is a scary place, anything could happen.
See if your SMTP server (the one running on localhost) has a nice log;
you may be able to watch the message get processed by the next hop.

By the way, I wouldn't bother with the try/except here. Just let the
exception bubble up and be emitted to stderr. It'll be more useful
that way :)

ChrisA

Cameron Simpson

unread,
May 30, 2013, 6:55:12 PM5/30/13
to pytho...@python.org
On 30May2013 15:48, inq1ltd <inq...@inqvista.com> wrote:
| python help,

Please do not make new discussions by replying to an old discussion.

It is not enough to change the subject line; unless you also remove
any References: and In-Reply-To: header lines your message is still
considered part of the old discussion.

| I've tried this code which I got from:
| http://www.tutorialspoint.com/python/python_sending_email.htm
|
| I build this file and run it
[...]
| smtpObj = smtplib.SMTP('localhost')
| smtpObj.sendmail(sender, receivers, message)
| print "Successfully sent email"
[...]
| After running the the file and I get
| "Successfully sent email"
|
| My question is why doesn't webmaster get an email?

Well, this suggests that the message has been accepted by the mail
system on localhost. Not that final delivery was made anywhere else.

You now have to read the log files on your mail system to see what happened.

One easy check to do first is to see if it is still in your mail
system but undelivered. On a UNIX system running the command:

mailq

should tell you that. If the queue is empty, the message has been
sent somewhere and you must dig through the logs to find out where.
If the message is in the queue then the "mailq" command will probably
give a suggestion as to why.

Cheers,
--
Cameron Simpson <c...@zip.com.au>

As you can see, unraveling even a small part of 'sendmail' can introduce more
complexity than answers. - Brian Costales, _sendmail_
Message has been deleted

inq1ltd

unread,
May 31, 2013, 12:07:58 PM5/31/13
to pytho...@python.org, Dennis Lee Bieber

 

Your responses helped.

 

The mailg for linux gave me information I didn't expect.

 

regards,

jol

0 new messages