Re: Idiomatic code validator?

2016-09-20 Thread Tim Johnson
* Steve D'Aprano  [160920 16:29]:
> On Wed, 21 Sep 2016 01:41 am, Tim Johnson wrote:
> 
> > Not to confuse idiomatic code validation with pep8 validation (I use
> > elpy on emacs)
> > 
> > Is there such a thing as a validator for _idiomatic_ code?
> 
> 
> Yes, it is called a linter. There are various linters available:
> 
> pylint, pychecker, jedi, flake
> 
> 
> there may be others. Depending on how good the linter is, they will do
> things like flag unused arguments, dead code, use of deprecated features,
> and so forth. Some of them may be very opinionated, e.g. flag uses of map()
> as unidiomatic and recommend a list comprehension instead. Whether you
> agree with that opinion or not is up to you.
  Sorry. Should have added this: It might be useful for me to use a more
  "opinionated" linter outside of my "IDE".
  cheers
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
  :) Again. Sorry!
 
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idiomatic code validator?

2016-09-20 Thread Tim Johnson
* Steve D'Aprano  [160920 16:29]:
> On Wed, 21 Sep 2016 01:41 am, Tim Johnson wrote:
> 
> > Not to confuse idiomatic code validation with pep8 validation (I use
> > elpy on emacs)
> > 
> > Is there such a thing as a validator for _idiomatic_ code?
> 
> 
> Yes, it is called a linter. There are various linters available:
> 
> pylint, pychecker, jedi, flake
  thanks Steve :

  I use flake8 thru elpy. I'm guessing that my inquiry is redundant.
(I might need to look at more fine-grained configuration thru
elpy)

  cheers
  - tj -
> 
> there may be others. Depending on how good the linter is, they will do
> things like flag unused arguments, dead code, use of deprecated features,
> and so forth. Some of them may be very opinionated, e.g. flag uses of map()
> as unidiomatic and recommend a list comprehension instead. Whether you
> agree with that opinion or not is up to you.
> 
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idiomatic code validator?

2016-09-20 Thread Steve D'Aprano
On Wed, 21 Sep 2016 01:41 am, Tim Johnson wrote:

> Not to confuse idiomatic code validation with pep8 validation (I use
> elpy on emacs)
> 
> Is there such a thing as a validator for _idiomatic_ code?


Yes, it is called a linter. There are various linters available:

pylint, pychecker, jedi, flake


there may be others. Depending on how good the linter is, they will do
things like flag unused arguments, dead code, use of deprecated features,
and so forth. Some of them may be very opinionated, e.g. flag uses of map()
as unidiomatic and recommend a list comprehension instead. Whether you
agree with that opinion or not is up to you.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idiomatic code validator?

2016-09-20 Thread Tim Johnson
* Terry Reedy  [160920 11:48]:
> On 9/20/2016 11:41 AM, Tim Johnson wrote:
> > Not to confuse idiomatic code validation with pep8 validation
> 
> Strictly speaking, there cannot be a mechanical PEP 8 validator, as any
> mechanical checker violates the admonitions of the beginning sections
> 'Introductions' and 'A Foolish Consistency is the Hobgoblin of Little
> Minds'.  For this reason, the core developers request the author of the
> checker formerly known as 'pep8' to change its name, which he did.
  elpy uses flake8
  https://github.com/jorgenschaefer/elpy/wiki/Configuration

> > Is there such a thing as a validator for _idiomatic_ code?
> 
> What would such a thing do?  Flag supposedly non-idiomatic code?  Or mark
> code recognized as 'idiomatic', with no implication either way about other
> code?
  Why not? 

> > I have Knupp's "Writing Idiomatic Python" and have bookmarked some
> > advisory websites that illustrate idiomatic style.
> 
> Do they all agree on 'idiomatic'?
  Not likely, I would not expect them to.
  Thanks

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idiomatic code validator?

2016-09-20 Thread Terry Reedy

On 9/20/2016 11:41 AM, Tim Johnson wrote:

Not to confuse idiomatic code validation with pep8 validation


Strictly speaking, there cannot be a mechanical PEP 8 validator, as any 
mechanical checker violates the admonitions of the beginning sections 
'Introductions' and 'A Foolish Consistency is the Hobgoblin of Little 
Minds'.  For this reason, the core developers request the author of the 
checker formerly known as 'pep8' to change its name, which he did.



Is there such a thing as a validator for _idiomatic_ code?


What would such a thing do?  Flag supposedly non-idiomatic code?  Or 
mark code recognized as 'idiomatic', with no implication either way 
about other code?



I have Knupp's "Writing Idiomatic Python" and have bookmarked some
advisory websites that illustrate idiomatic style.


Do they all agree on 'idiomatic'?  I am sure that the long-time frequent 
contributors on python list do not.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list