unexpected output while using list(and nested dictionary)

Steven D'Aprano steve at pearwood.info
Thu Jul 23 16:57:42 CEST 2015


On Fri, 24 Jul 2015 12:04 am, max scalf wrote:

> I am sorry for doing what i did (asking question in Stackoverflow and
> pasting the link here).  I will keep this in mind for the future.  I am
> very much new to this list, so was not sure.
> 
> 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.

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. 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.

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.

Worst case, you can post your code in a pastebin, or some other website. But
by doing so, understand that (1) you are limiting the usefulness of your
question to others, who might learn from it in the future, and (2) limiting
the number of people who are willing and able to answer.




-- 
Steven



More information about the Python-list mailing list