On Fri, 12 Nov 2021 at 03:46, Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Thu, Nov 11, 2021 at 10:06:45PM -0500, Ricky Teachey wrote:
>
> > Is there a standard idiom-- perhaps using a type-hint-- to signal to the
> > IDE/linter that my user-defined class is intended to be used as a
> > function/factory, and not as a type (even though it is in fact a type)?
>
> Not really. I don't think there is even a standard idiom for the human
> reader to decide whether something is used as a "function" or a "class".
> It is subjective, based on usage and convention.

Precisely. And that's why automated tools like flake8 can't reliably
enforce rules like this, because they can't determine intent.

On Fri, 12 Nov 2021 at 00:30, Brendan Barnwell <brenb...@brenbarn.net> wrote:
>
>         I think this is a big part of the problem.  There are various tools 
> out
> there (flake8 being one of them) that purport to "improve" or "fix" your
> code (or warn you to do it yourself), and various companies and
> organizations that adopt policies tied to those tools (e.g., "your pull
> request must pass this PEP 8 linter to be accepted").  It's a big problem.

Very much this. Tools like flake8 aren't bad in themselves (they catch
when I make dumb typos in my code, and I'm grateful for that) but
treating them as if they had the final say on what is acceptable code
is vey bad (there's a reason linters support "#fmt: off").
Unfortunately, this usually (in my experience) comes about through a
"slippery slope" of people saying that mandating a linter will stop
endless debates over style preferences, as we'll just be able to say
"did the linter pass?" and move on. This of course ignores the fact
that (again, in my experience) far *more* time is wasted complaining
about linter rules than was ever lost over arguments about style :-(

Paul

PS Thanks to Ethan for clarifying my posting much better than I managed to :-)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YG7R4UX5ZJKFINJ3AW4BOGH3RNZJXVDS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to