unexpected output while using list(and nested dictionary)

Grant Edwards invalid at invalid.invalid
Thu Jul 23 19:08:39 CEST 2015

On 2015-07-23, Steven D'Aprano <steve at pearwood.info> wrote:
> On Fri, 24 Jul 2015 12:04 am, max scalf wrote:


>> Do you guys have any suggestion as to what to use if the code is
>> lone, as the formatting gets lost in an email...
> Use a tool that doesn't break your emails.
> If you turn "Rich Text" or "Formatted Text" on, your mail will be
> sent as HTML code. That is a poor choice for formatting text, but
> it's a standard now, no matter the disadvantages (and there are
> many). HTML will wreck your formatting.

In theory, code inside a <pre></pre> tag should be more-or-less OK
(most of the time), but people sending HTML e-mail never seem to know
how to do that.  [Or probably their e-mail client is too broken to
even allow such a thing.]

> If you turn "Rich Text" or "Formatting" off, and send as regular
> plain text with no bold, italics, inline pictures, dancing
> paperclips, embedded music or whatever other nonsense people like to
> stick in their emails these days, then any decent mail client will
> send *exactly what you type* with no frills or mangling. So if you
> type:
> def function(a, b):
>     return a + 2*b  # that's four spaces at the start of the line
> then that's exactly what will be sent, including the four spaces.

That's definitely, by far, the very best option.

> If your mail program doesn't do that, then it is broken, like a car
> that can only turn left or a toaster that sets fire to the bread. Use
> a better email program.

I recomment mutt if you really want to stick with getting everything
e-mailed to you (which I personally don't like).  Better yet (IMO)
point slrn or your favorite NNTP client at comp.lang.python on your
friendly local Usenet server or at gmane's nntp server at

> Another alternative is to save your code in a .py file, then attach
> it to the email as an attachment. Even the most obnoxious email
> program doesn't mangle attachments, at least not deliberately. But
> that can be inconvenient.

A lot of people are not going to open attachments sent by some random
stranger.  Some people might (even though they probably should not),
but it could be the person who knows the answer to your problem won't
bother -- either because of the effor or risk involved.  Especially on
Windows, opening e-mail attachments seems to be a rather dangerous
thing to do.

Do attachments sent to the mailing list make it realiably through
gateways to places like comp.lang.python or into gmane's "view" of the
mailing list?

Grant Edwards               grant.b.edwards        Yow! Let me do my TRIBUTE
                                  at               to FISHNET STOCKINGS ...

More information about the Python-list mailing list