[python-advocacy] example code
Roy Smith
roy at panix.com
Fri Nov 13 02:33:51 CET 2009
On Nov 12, 2009, at 6:03 PM, Tennessee Leeuwenburg wrote:
> Just another option...
>
> print "Python is" + ', '.join([index + ', ' + each for each in
> python])
Our job here is that of pitchman, huckster, pimp even. We have very
little time to capture somebody's interest. What we are talking about
is a tease. Quick, obvious, to the point. If our audience has to
stop and think to understand what they're reading, we've already lost.
In other words, KISS.
>
> On Fri, Nov 13, 2009 at 4:20 AM, Aahz <aahz at pythoncraft.com> wrote:
> On Thu, Nov 12, 2009, Ray Allen wrote:
> >
> > # Create list
> > python = ["Easy to read",
> > "Fast to code",
> > "Quick to learn",
> > "Modular and object oriented"]
>
> AFAIK, almost everyone indents multi-line expressions. There are
> several
> ways to do it, this is my preferred version:
>
> python = [
> "Easy to read",
> "Fast to code",
> "Quick to learn",
> "Modular and object oriented",
> ]
>
> The reason I prefer this is because it makes it easy to edit the list,
> specifically including the trailing comma on the last element. (E.g.
> it's much easier to delete the first list element than when you put it
> next to the opening bracket -- just delete the line.) It's also
> easy to
> read because the beginning and end of the list are highly visible. I
> prefer to indent only one level rather than matching up the
> beginning and
> ending brackets because that gives more line length to the list
> contents.
> --
> Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
>
> [on old computer technologies and programmers] "Fancy tail fins on a
> brand new '59 Cadillac didn't mean throwing out a whole generation of
> mechanics who started with model As." --Andrew Dalke
> _______________________________________________
> Advocacy mailing list
> Advocacy at python.org
> http://mail.python.org/mailman/listinfo/advocacy
>
>
>
> --
> --------------------------------------------------
> Tennessee Leeuwenburg
> http://myownhat.blogspot.com/
> "Don't believe everything you think"
> _______________________________________________
> Advocacy mailing list
> Advocacy at python.org
> http://mail.python.org/mailman/listinfo/advocacy
----------------
Roy Smith
roy at panix.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/advocacy/attachments/20091112/09a31d7f/attachment-0001.htm>
More information about the Advocacy
mailing list