Learn Python the Hardway exercise 11 question 4

Dan Stromberg drsalists at gmail.com
Thu Mar 31 17:28:53 EDT 2011


On Thu, Mar 31, 2011 at 1:35 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Apr 1, 2011 at 4:54 AM, Dan Stromberg <drsalists at gmail.com> wrote:
> >
> > http://stromberg.dnsalias.org/~strombrg/significant-whitespace.html
> >
>
> I was trolling, I know the reasons behind it. Anyway, most people
> don't share code by email! (Actually, since you seem to be the author
> of that page - could you address that particular point? I think it's
> probably as big an issue as any of the others, to today's coders -
> "code semantics get destroyed by forums/email/etc/etc/etc".)
>
> Solution: All emailed code should begin with
> from __future__ import braces
> And there you are, out of your difficulty at once!
>

Updated:

http://stromberg.dnsalias.org/~strombrg/significant-whitespace.html

Another I can only partially refute: If you're having an e-mail discussion
about code, some mailers like to reformat your code into a paragraph.
Needless to say, this is bad for pretty much all code, but pathological for
Python and other languages that use whitespace in a manner distinct from
basic paragraph-filling.

Some alternatives:

   - Use a proper code review tool instead - EG
Rietveld<http://code.google.com/p/rietveld/>.

   - Use a wiki instead - sometimes with a <source lang="python"> tag (EG,
   on Wikipedia <http://en.wikipedia.org/wiki/Binary_logarithm>).
   - Use HTML e-mail and a <pre> tag
      - Except this'll have problems with real <'s and >'s - which are
      common in Python and other languages.
      - You can pipe your Python through this
sed<http://en.wikipedia.org/wiki/Sed>command to deal with real <'s and
>'s
         - sed -e 's/</\</g' -e 's/>/\>/g'
      - Note that this is no more onerous than running code through a code
      beautifier
   - Use a non-borken MUA <http://en.wikipedia.org/wiki/Mail_user_agent>like
   mutt <http://www.mutt.org/> for such communications
   - Mail your code as an attachment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110331/002e07ec/attachment.html>


More information about the Python-list mailing list