Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9628

Re: Proposal to extend PEP 257 (New Documentation String Spec)

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '(except': 0.05; 'remind': 0.05; 'width': 0.05; 'forcing': 0.07; 'function,': 0.07; 'linear': 0.07; 'marking': 0.07; 'suggesting': 0.07; 'python': 0.08; 'context.': 0.09; 'correct.': 0.09; 'default.': 0.09; 'demanding': 0.09; 'likely.': 0.09; 'seriously.': 0.09; 'snippets': 0.09; 'so?': 0.09; 'width.': 0.09; 'syntax': 0.11; 'am,': 0.13; 'wrote:': 0.15; '"syntax': 0.16; 'braces?': 0.16; 'bumping': 0.16; 'code).': 0.16; 'conclusion:': 0.16; 'do)': 0.16; 'docstring': 0.16; 'docstrings': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'go?': 0.16; 'indent': 0.16; 'lines)': 0.16; 'out?': 0.16; 'problem!': 0.16; 'rantingrick': 0.16; 'subject:PEP': 0.16; 'tendency': 0.16; 'argument': 0.16; 'class,': 0.16; 'tries': 0.16; 'def': 0.16; 'meant': 0.17; 'functions,': 0.19; 'received:209.85.210.174': 0.19; 'received :mail-iy0-f174.google.com': 0.19; 'stick': 0.19; '(which': 0.20; 'language': 0.20; '(like': 0.21; 'this?': 0.22; 'header:In-Reply- To:1': 0.22; 'indentation': 0.23; 'referring': 0.23; 'obviously': 0.23; 'code': 0.24; "python's": 0.25; '(or': 0.25; 'parameters': 0.25; 'string': 0.26; 'function': 0.26; '(and': 0.27; "i'm": 0.27; 'concern': 0.28; 'bit': 0.28; 'message-id:@mail.gmail.com': 0.28; 'bound': 0.29; 'variables': 0.29; 'do.': 0.30; 'brain': 0.30; 'far,': 0.30; 'for,': 0.30; 'if,': 0.30; 'sun,': 0.30; 'syntax,': 0.30; 'programmers': 0.31; 'lines': 0.31; 'shared': 0.32; 'source': 0.32; 'named': 0.32; 'chris': 0.32; 'cases': 0.32; 'setting': 0.32; 'too': 0.32; 'break': 0.33; 'rather': 0.33; 'usually': 0.33; "what's": 0.33; 'to:addr:python-list': 0.34; 'there': 0.34; 'someone': 0.34; 'characters': 0.34; '17,': 0.35; 'doc': 0.35; 'function.': 0.35; 'itself,': 0.35; 'languages.': 0.35; 'maintained': 0.35; 'preserve': 0.35; 'totally': 0.35; 'idea': 0.36; 'rules': 0.36; 'element': 0.37; 'anything': 0.37; 'some': 0.37; 'passed': 0.37; 'but': 0.37; 'using': 0.37; 'another': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'strong': 0.38; 'other.': 0.62; 'piece': 0.62; 'full': 0.63; 'costs': 0.64; 'ever': 0.65; 'here': 0.66; 'president': 0.66; 'making': 0.66; 'demand': 0.66; 'here.': 0.66; 'limit': 0.66; 'buy': 0.67; 'show': 0.67; 'attitude': 0.67; 'bodies': 0.67; 'flow': 0.68; 'freedom': 0.68; 'strange': 0.68; 'become': 0.72; 'informative': 0.73; 'secondary': 0.73; 'spaces': 0.73; 'biggest': 0.74; 'lose': 0.82; "'foo'": 0.84; 'gain.': 0.84; 'huh?': 0.84; 'imagination': 0.84; 'lengthy': 0.84; 'one).': 0.84; 'poorly': 0.84; 'fall.': 0.91; 'good,': 0.91; 'hassle.': 0.91; 'societal': 0.91; 'subject:Proposal': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=oB/3eqFtIHgkwISlh3jovfxHuG3AL4OgLmeBc9Rc1RQ=; b=lvTA1ynKEIZR5KkKMjejTsmw6rLFLSW5Fn4MNFl2sIH8rnek+kb0JDW2JwNxxIYo1+ Iqo2Do7kuqq+fm496hI+UjGsageqHUHpV4kvcyQxZ1e87+xTfQe1/yE3EXrMsqn3y0sB 4RoTE8NGgy4XuMplmFgIopnz1BRdGHxtmxynI=
MIME-Version 1.0
In-Reply-To <ca8079b9-b4b1-4dec-a951-9d488f7cb201@cq10g2000vbb.googlegroups.com>
References <120629e8-3b37-4e8c-a472-cd361de15de4@g9g2000yqb.googlegroups.com> <mailman.1048.1310714025.1164.python-list@python.org> <cb71a0e9-741d-4406-ac8d-a85abbf7571c@g16g2000yqg.googlegroups.com> <mailman.1086.1310771799.1164.python-list@python.org> <ca8079b9-b4b1-4dec-a951-9d488f7cb201@cq10g2000vbb.googlegroups.com>
Date Sun, 17 Jul 2011 02:25:58 +1000
Subject Re: Proposal to extend PEP 257 (New Documentation String Spec)
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1114.1310833560.1164.python-list@python.org> (permalink)
Lines 106
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310833560 news.xs4all.nl 23864 [2001:888:2000:d::a6]:36358
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9628

Show key headers only | View raw


On Sun, Jul 17, 2011 at 1:32 AM, rantingrick <rantingrick@gmail.com> wrote:
> On Jul 15, 6:16 pm, Chris Angelico <ros...@gmail.com> wrote:
>> Not Ruby, but to other languages. There's this guy in my house named
>> Chris who tries his best to avoid Python if the code is going to be
>> shared over any "dodgy medium" where indentation might be damaged.
>
> Are you referring to "mediums" that delete leading white-space? First
> of all you should avoid using these "mediums" at all costs HOWEVER if
> you are forced to do so there are ways to format your code to preserve
> indentation. The most easy way to do this is by marking indentation
> with arrows.
>
> def foo():
> --->for x in range(10):
> --->--->print 'foo'

So, uhh, remind me how this is better than marking indentation with braces?

> OBVIOUSLY you have no imagination Chris! I would much rather have
> forced indention in my language (and need to process code from the web
> from time to time) than to NOT have indention and be forced to read
> sloppy and poorly formatted code ALL THE TIME. Did you ever find it
> strange that most programmers format there code with indention even
> when they are not forced to do so?

No, I don't. But if I'm sharing code snippets with people on a MUD,
then I like being able to quote some code and not have to worry about
whether the other person gets a bit of extra indentation on some of
the lines (which is more common than totally destroying indentation,
but both damage Python code).

> Do you really want to have a setup (like we currently do) where people
> are just making up the rules for doc-strings as they go? Because
> setting such a president is exactly why we have a stdlib full of
> poorly formatted doc-strings?

Yes, I do. I absolutely, wholeheartedly do.

>> 1) Every syntax element MUST add indentation.
>
> Huh? Are you suggesting that syntax errors only concern indention? I
> think you'd better give a few more moments thought to that brain fart
> Chris.

Huh?

I'm making a syllogistic argument here (or something approximating to
one). By "syntax element" I don't mean every single piece of syntax,
but all the major ones - if, while, for, etc. They all demand
indentation. Let's say you're indenting 4 spaces per indent - a not
unreasonable default. Then 80 characters gives you a hard limit of 20
indentation levels, and a soft limit of 6-8 before you lose a
significant proportion of your available width to the indent.

>> 2) Strong encouragement to stick to an 80-character line
>> Conclusion: Every big function will become two smaller functions, one
>> of which calls the other.
>
> Are you nuts! I have many multi-line functions (like 50 or more lines)
> that never go passed 80 chars in width. Sure if you want to break up
> long function bodies you can but in some cases a linear flow with good
> comments is all you need (no matter how long it might be).

..... 50 lines is your idea of big? Seriously. I have maintained
monolithic functions with far, far more lines than that - and it's
just not been worth the hassle of factoring anything out. I'd have
ended up passing most of the local variables as parameters anyway, so
it's not much of a gain.

>> 3) Every function that has a docstring MUST have it fully formatted.
>> Secondary conclusion: The only functions with docstrings are the ones
>> that are meant to be called externally.
>
> WRONG! And that attitude is a MAJOR source of the problem! EVERY
> function, EVERY class, and EVERY method should include an informative
> doc string (except in the case of blindingly "self explanatory" and
> simple functions and methods).

And that's your problem. You will have a maintenance nightmare because
every factoring-out of a function will give you twice as many
docstrings to maintain; you're forced to put something lengthy at the
top of what's basically just another part of the same function. That's
why I said that demanding properly-formatted docstrings will mean that
those factored-out functions will be treated as part of the SAME
function, and not docstringed at all - it's just not worth the hassle.
(Or, more likely, a requirement like that will lead people to just not
factor out the function at all.)

> FREEDOM IS GOOD, UNBRIDLED FREEDOM IS THE ROOT OF ALL SORROWS!

Yeah, I don't buy that one. All freedom is within boundaries;
unbridled freedom (what most people would call anarchy) has a tendency
to automatically bound itself, usually by "whoever has the biggest gun
makes the rules" in a societal context.

> <sarcasm> Oh yes Chris you are SO correct. Forcing people to write
> good doc-strings is going to be Python's down fall. How did i not see
> this? You are so wise! And your straw-men are so DAMN convincing.</
> sarcasm>

Python's downfall? Nah, not likely. There've been too many of those,
and it's still here. Ranting Rick's downfall? Also not likely. My
downfall at 2AM after a long show bumping out? That's more plausible.
Someone needs to remind me not to feed the trolls...

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Proposal to extend PEP 257 (New Documentation String Spec) rantingrick <rantingrick@gmail.com> - 2011-07-14 16:02 -0700
  Re: Proposal to extend PEP 257 (New Documentation String Spec) Ben Finney <ben+python@benfinney.id.au> - 2011-07-15 10:24 +1000
  Re: Proposal to extend PEP 257 (New Documentation String Spec) Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-07-15 02:00 -0400
  Re: Proposal to extend PEP 257 (New Documentation String Spec) Chris Angelico <rosuav@gmail.com> - 2011-07-15 17:13 +1000
    Re: Proposal to extend PEP 257 (New Documentation String Spec) rantingrick <rantingrick@gmail.com> - 2011-07-15 11:56 -0700
      Re: Proposal to extend PEP 257 (New Documentation String Spec) Chris Angelico <rosuav@gmail.com> - 2011-07-16 09:16 +1000
        Re: Proposal to extend PEP 257 (New Documentation String Spec) rantingrick <rantingrick@gmail.com> - 2011-07-16 08:32 -0700
          Re: Proposal to extend PEP 257 (New Documentation String Spec) Chris Angelico <rosuav@gmail.com> - 2011-07-17 02:25 +1000
          Re: Proposal to extend PEP 257 (New Documentation String Spec) Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-16 18:03 -0500
            Re: Proposal to extend PEP 257 (New Documentation String Spec) rantingrick <rantingrick@gmail.com> - 2011-07-16 16:25 -0700
              Re: Proposal to extend PEP 257 (New Documentation String Spec) Chris Angelico <rosuav@gmail.com> - 2011-07-17 09:45 +1000
          Re: Proposal to extend PEP 257 (New Documentation String Spec) Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-16 18:44 -0500
      Re: Proposal to extend PEP 257 (New Documentation String Spec) Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-07-16 15:23 -0400
        Re: Proposal to extend PEP 257 (New Documentation String Spec) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-17 13:10 +1000
          Re: Proposal to extend PEP 257 (New Documentation String Spec) Tim Chase <python.list@tim.thechases.com> - 2011-07-17 06:11 -0500
            Re: Proposal to extend PEP 257 (New Documentation String Spec) rantingrick <rantingrick@gmail.com> - 2011-07-17 10:30 -0700
      Re: Proposal to extend PEP 257 (New Documentation String Spec) Chris Angelico <rosuav@gmail.com> - 2011-07-17 09:09 +1000
  Re: Proposal to extend PEP 257 (New Documentation String Spec) George Rodrigues da Cunha Silva <georger.silva@gmail.com> - 2011-07-15 12:44 -0300

csiph-web