Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45232 > unrolled thread

[Off topic] Software epigrams

Started bySteven D'Aprano <steve+comp.lang.python@pearwood.info>
First post2013-05-13 09:20 +0000
Last post2013-05-15 20:55 -0700
Articles 20 on this page of 22 — 10 participants

Back to article view | Back to comp.lang.python


Contents

  [Off topic] Software epigrams Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-13 09:20 +0000
    Re: [Off topic] Software epigrams "marduk@python.net" <marduk@python.net> - 2013-05-13 10:56 -0400
    Re: [Off topic] Software epigrams Chris Angelico <rosuav@gmail.com> - 2013-05-14 03:47 +1000
    Re: [Off topic] Software epigrams Skip Montanaro <skip@pobox.com> - 2013-05-13 13:02 -0500
      Re: [Off topic] Software epigrams Neil Cerutti <neilc@norwich.edu> - 2013-05-13 18:42 +0000
        Re: [Off topic] Software epigrams Fábio Santos <fabiosantosart@gmail.com> - 2013-05-13 21:49 +0100
          Re: [Off topic] Software epigrams Neil Cerutti <neilc@norwich.edu> - 2013-05-15 17:24 +0000
            Re: [Off topic] Software epigrams Fábio Santos <fabiosantosart@gmail.com> - 2013-05-15 18:49 +0100
              Re: [Off topic] Software epigrams Neil Cerutti <neilc@norwich.edu> - 2013-05-15 18:27 +0000
                Re: [Off topic] Software epigrams Fábio Santos <fabiosantosart@gmail.com> - 2013-05-16 01:21 +0100
                  Re: [Off topic] Software epigrams Neil Cerutti <neilc@norwich.edu> - 2013-05-16 14:23 +0000
                    Re: [Off topic] Software epigrams Chris Angelico <rosuav@gmail.com> - 2013-05-17 00:37 +1000
                      Re: Software epigrams rusi <rustompmody@gmail.com> - 2013-05-16 08:06 -0700
                        Re: Software epigrams Chris Angelico <rosuav@gmail.com> - 2013-05-17 01:19 +1000
            python 2.7 vs 2.5 inq1ltd <inq1ltd@inqvista.com> - 2013-05-15 16:56 -0400
            sendmail smtplib.SMTP('localhost') Where is the email? inq1ltd <inq1ltd@inqvista.com> - 2013-05-30 15:48 -0400
            Re: sendmail smtplib.SMTP('localhost') Where is the email? Chris Angelico <rosuav@gmail.com> - 2013-05-31 08:13 +1000
            Re: sendmail smtplib.SMTP('localhost') Where is the email? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-30 19:23 -0400
    Re: [Off topic] Software epigrams Chris Angelico <rosuav@gmail.com> - 2013-05-14 04:12 +1000
      Re: [Off topic] Software epigrams Dan Sommers <dan@tombstonezero.net> - 2013-05-14 03:08 +0000
        Re: [Off topic] Software epigrams Chris Angelico <rosuav@gmail.com> - 2013-05-14 13:28 +1000
        Re: Software epigrams rusi <rustompmody@gmail.com> - 2013-05-15 20:55 -0700

Page 1 of 2  [1] 2  Next page →


#45232 — [Off topic] Software epigrams

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-05-13 09:20 +0000
Subject[Off topic] Software epigrams
Message-ID<5190b049$0$29978$c3e8da3$5496439d@news.astraweb.com>
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

[toc] | [next] | [standalone]


#45244

From"marduk@python.net" <marduk@python.net>
Date2013-05-13 10:56 -0400
Message-ID<mailman.1627.1368457004.3114.python-list@python.org>
In reply to#45232

On Mon, May 13, 2013, at 05:20 AM, Steven D'Aprano wrote:
> 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.

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.

[toc] | [prev] | [next] | [standalone]


#45254

FromChris Angelico <rosuav@gmail.com>
Date2013-05-14 03:47 +1000
Message-ID<mailman.1636.1368467255.3114.python-list@python.org>
In reply to#45232
On Mon, May 13, 2013 at 7:20 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> 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.

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

[toc] | [prev] | [next] | [standalone]


#45255

FromSkip Montanaro <skip@pobox.com>
Date2013-05-13 13:02 -0500
Message-ID<mailman.1637.1368468166.3114.python-list@python.org>
In reply to#45232
> 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

[toc] | [prev] | [next] | [standalone]


#45261

FromNeil Cerutti <neilc@norwich.edu>
Date2013-05-13 18:42 +0000
Message-ID<avcqgkFbdrbU1@mid.individual.net>
In reply to#45255
On 2013-05-13, Skip Montanaro <skip@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

[toc] | [prev] | [next] | [standalone]


#45263

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-13 21:49 +0100
Message-ID<mailman.1642.1368478473.3114.python-list@python.org>
In reply to#45261

[Multipart message — attachments visible in raw view] — view raw

On 13 May 2013 19:48, "Neil Cerutti" <neilc@norwich.edu> wrote:
>
> On 2013-05-13, Skip Montanaro <skip@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
> --
> 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.

[toc] | [prev] | [next] | [standalone]


#45359

FromNeil Cerutti <neilc@norwich.edu>
Date2013-05-15 17:24 +0000
Message-ID<avhumdFft7tU1@mid.individual.net>
In reply to#45263
On 2013-05-13, F?bio Santos <fabiosantosart@gmail.com> wrote:
>
> On 13 May 2013 19:48, "Neil Cerutti" <neilc@norwich.edu> wrote:
>>
>> On 2013-05-13, Skip Montanaro <skip@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
>> --
>> 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.

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

[toc] | [prev] | [next] | [standalone]


#45361

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-15 18:49 +0100
Message-ID<mailman.1712.1368640178.3114.python-list@python.org>
In reply to#45359

[Multipart message — attachments visible in raw view] — view raw

On 15 May 2013 18:29, "Neil Cerutti" <neilc@norwich.edu> wrote:
>
> On 2013-05-13, F?bio Santos <fabiosantosart@gmail.com> wrote:
> >
> > On 13 May 2013 19:48, "Neil Cerutti" <neilc@norwich.edu> wrote:
> >>
> >> On 2013-05-13, Skip Montanaro <skip@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.

[toc] | [prev] | [next] | [standalone]


#45364

FromNeil Cerutti <neilc@norwich.edu>
Date2013-05-15 18:27 +0000
Message-ID<avi2crFggb1U1@mid.individual.net>
In reply to#45361
On 2013-05-15, F?bio Santos <fabiosantosart@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

[toc] | [prev] | [next] | [standalone]


#45383

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-16 01:21 +0100
Message-ID<mailman.1726.1368663721.3114.python-list@python.org>
In reply to#45364

[Multipart message — attachments visible in raw view] — view raw

On 15 May 2013 19:33, "Neil Cerutti" <neilc@norwich.edu> wrote:
>
> On 2013-05-15, F?bio Santos <fabiosantosart@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
> --
> 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?

[toc] | [prev] | [next] | [standalone]


#45424

FromNeil Cerutti <neilc@norwich.edu>
Date2013-05-16 14:23 +0000
Message-ID<avk8f0Fs40U1@mid.individual.net>
In reply to#45383
On 2013-05-16, F?bio Santos <fabiosantosart@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

[toc] | [prev] | [next] | [standalone]


#45426

FromChris Angelico <rosuav@gmail.com>
Date2013-05-17 00:37 +1000
Message-ID<mailman.1754.1368715060.3114.python-list@python.org>
In reply to#45424
On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti <neilc@norwich.edu> wrote:
> On 2013-05-16, F?bio Santos <fabiosantosart@gmail.com> wrote:
>> 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.

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

[toc] | [prev] | [next] | [standalone]


#45429 — Re: Software epigrams

Fromrusi <rustompmody@gmail.com>
Date2013-05-16 08:06 -0700
SubjectRe: Software epigrams
Message-ID<2a8e503f-50c0-4d13-8ea3-c310575c977e@wg15g2000pbb.googlegroups.com>
In reply to#45426
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:
> > On 2013-05-16, F?bio Santos <fabiosantos...@gmail.com> wrote:
> >> 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.
>
> 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

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

[toc] | [prev] | [next] | [standalone]


#45433 — Re: Software epigrams

FromChris Angelico <rosuav@gmail.com>
Date2013-05-17 01:19 +1000
SubjectRe: Software epigrams
Message-ID<mailman.1758.1368717580.3114.python-list@python.org>
In reply to#45429
On Fri, May 17, 2013 at 1:06 AM, rusi <rustompmody@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

[toc] | [prev] | [next] | [standalone]


#45373 — python 2.7 vs 2.5

Frominq1ltd <inq1ltd@inqvista.com>
Date2013-05-15 16:56 -0400
Subjectpython 2.7 vs 2.5
Message-ID<mailman.1720.1368653362.3114.python-list@python.org>
In reply to#45359

[Multipart message — attachments visible in raw view] — view raw

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



[toc] | [prev] | [next] | [standalone]


#46541 — sendmail smtplib.SMTP('localhost') Where is the email?

Frominq1ltd <inq1ltd@inqvista.com>
Date2013-05-30 15:48 -0400
Subjectsendmail smtplib.SMTP('localhost') Where is the email?
Message-ID<mailman.2450.1369945339.3114.python-list@python.org>
In reply to#45359

[Multipart message — attachments visible in raw view] — view raw

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 = "inq1ltd@inqvista.com"
receivers = ["webmaster@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









[toc] | [prev] | [next] | [standalone]


#46548 — Re: sendmail smtplib.SMTP('localhost') Where is the email?

FromChris Angelico <rosuav@gmail.com>
Date2013-05-31 08:13 +1000
SubjectRe: sendmail smtplib.SMTP('localhost') Where is the email?
Message-ID<mailman.2456.1369952036.3114.python-list@python.org>
In reply to#45359
On Fri, May 31, 2013 at 5:48 AM, inq1ltd <inq1ltd@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

[toc] | [prev] | [next] | [standalone]


#46556 — Re: sendmail smtplib.SMTP('localhost') Where is the email?

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-05-30 19:23 -0400
SubjectRe: sendmail smtplib.SMTP('localhost') Where is the email?
Message-ID<mailman.2461.1369956231.3114.python-list@python.org>
In reply to#45359
On Thu, 30 May 2013 15:48:20 -0400, inq1ltd <inq1ltd@inqvista.com>
declaimed the following in gmane.comp.python.general:

> 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 = "inq1ltd@inqvista.com"
> receivers = ["webmaster@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?

	Since you specified "localhost", that implies you have an SMTPd
running on your own machine. Since you didn't get an exception, that
SMTPd accepted the message.

	You now need to find out what that SMTPd did with the message... Is
it configured to relay to the mail server for "inqvista.com"?

	This is outside the domain of Python.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#45257

FromChris Angelico <rosuav@gmail.com>
Date2013-05-14 04:12 +1000
Message-ID<mailman.1639.1368468776.3114.python-list@python.org>
In reply to#45232
On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro <skip@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

[toc] | [prev] | [next] | [standalone]


#45279

FromDan Sommers <dan@tombstonezero.net>
Date2013-05-14 03:08 +0000
Message-ID<lUhkt.420$iS.256@newsfe27.iad>
In reply to#45257
On Tue, 14 May 2013 04:12:53 +1000, Chris Angelico wrote:

> On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro <skip@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

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.python


csiph-web