[Tutor] Emailing code

Steven D'Aprano steve at pearwood.info
Sat Apr 7 03:07:02 CEST 2012


myles broomes wrote:
> This question isnt so much related to a specific program, just something im
> curious about. What is the best way to email code? I find that when i copy
> and paste it into an email, the indentation and spacing gets all messed up.

Don't send HTML, because that is poison to correct formatting of Python code. 
Mail clients feel free to reformat indentation and spacing in arbitrary ways 
with HTML emails. Find the setting in your mail client to turn off all 
formatting. My guess is that you are using Outlook or Outlook Express -- look 
for the setting about "Rich Text", and turn that off.

If you can't turn it off, at least turn on the option to send both HTML (rich 
text) and plain text. The HTML version will probably be mangled, but the plain 
text version should be okay.

If you are using Thunderbird, turning off format=flowed can sometimes help.

http://kb.mozillazine.org/Plain_text_e-mail_%28Thunderbird%29

For large amounts of code, don't copy and paste into your email. Nearly every 
email program in the world allows you to attach attachments. Just attach the 
.py file and send that.




-- 
Steven



More information about the Tutor mailing list