Style question

Discussion in 'Python' started by Leif K-Brooks, Jul 8, 2004.

  1. The style guide says that a wrapped line should be aligned with where
    the wrapped part started. But what is the most readable thing to do when
    that's impossible? For instance (ignore the wrap caused by my news
    reader), where should the second variable name be wrapped to in this line?

    really_really_long_variable_name =
    another_even_longer_variable_name_with_cookies
    Leif K-Brooks, Jul 8, 2004
    #1
    1. Advertising

  2. Leif K-Brooks

    Peter Hansen Guest

    Leif K-Brooks wrote:

    > The style guide says that a wrapped line should be aligned with where
    > the wrapped part started. But what is the most readable thing to do when
    > that's impossible? For instance (ignore the wrap caused by my news
    > reader), where should the second variable name be wrapped to in this line?
    >
    > really_really_long_variable_name =
    > another_even_longer_variable_name_with_cookies


    Ignoring the style guide on this issue, I always indent wrapped
    lines one indentation level beyond the previous line.

    "It's the only thing that makes sense." (TM)

    -Peter
    Peter Hansen, Jul 8, 2004
    #2
    1. Advertising

  3. On Wed, 07 Jul 2004 21:16:04 -0400, Leif K-Brooks <> wrote:
    > The style guide says that a wrapped line should be aligned with where
    > the wrapped part started. But what is the most readable thing to do when
    > that's impossible? For instance (ignore the wrap caused by my news
    > reader), where should the second variable name be wrapped to in this line?
    >
    > really_really_long_variable_name =
    > another_even_longer_variable_name_with_cookies


    To me, a style guide is a _GUIDE_, not a _LAW_.
    So for cases that are not covered, do something sensible in the spirit
    of the guide.

    (what also may help is ask yourself the question whether you really want
    to do something that doesn't fit the style guide. In many cases,
    doing something outside 'normal' is an indication that there are
    alternative (better?) solutions.)

    Albert
    --
    Unlike popular belief, the .doc format is not an open publically available format.
    Albert Hofkamp, Jul 8, 2004
    #3
  4. [Leif K-Brooks]

    > But what is the most readable thing to do when that's impossible? For
    > instance, where should the second variable name be wrapped to in this
    > line?


    > really_really_long_variable_name =
    > another_even_longer_variable_name_with_cookies


    I would suggest one of two writings. Some people would do:

    really_really_long_variable_name = \
    another_even_longer_variable_name_with_cookies

    yet I prefer:

    really_really_long_variable_name = (
    another_even_longer_variable_name_with_cookies)

    because I like to avoid escaped newlines (save in triple-quoted strings).

    --
    François Pinard http://www.iro.umontreal.ca/~pinard
    =?iso-8859-1?Q?Fran=E7ois?= Pinard, Jul 8, 2004
    #4
  5. Leif K-Brooks a écrit :
    > The style guide says that a wrapped line should be aligned with where
    > the wrapped part started. But what is the most readable thing to do when
    > that's impossible? For instance (ignore the wrap caused by my news
    > reader), where should the second variable name be wrapped to in this line?
    >
    > really_really_long_variable_name =
    > another_even_longer_variable_name_with_cookies


    <troll>
    Isn't there something in the style guide about
    really_really_long_variable_name ?-)
    </troll>
    bruno modulix, Jul 8, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Nicholson
    Replies:
    3
    Views:
    716
    Rob Nicholson
    May 28, 2005
  2. Replies:
    0
    Views:
    2,453
  3. Replies:
    1
    Views:
    785
    Bertilo Wennergren
    Nov 24, 2003
  4. Hardeep Rakhra
    Replies:
    8
    Views:
    639
    Hardeep Rakhra
    Jan 15, 2004
  5. Ken Varn
    Replies:
    0
    Views:
    439
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page