(original) (raw)
> stub files are only used to type-check \*users\* of a module. If you want a
module itself to be type-checked you have to use inline type hints
is this a fundamental limitation, or just the current state of tooling?On 20 April 2015 at 21:48, Harry Percival <harry.percival@gmail.com> wrote:
> "I hate stub files. \[...\] in my opinion, \[it\] just about guarantees a maintenance burden that will fall by the side of the road.I'm not so pessimistic. It's not like documentation or docstrings or comments -- the whole point is that it should be very easy to have an automated check for whether your stubs are in sync with your source, because both are in code. Unlike docs or comments which can easily become out of date, because there's no automated process to tell you they need updating... I'm thinking of it as a thing your editor will warn you of. Like pyflakes warnings about unused variables & co, I'm never happy until I've silenced them all in a file, and similarly, your editor will keep bugging you until you've got your stubs inline with your code...--On 20 April 2015 at 20:37, Isaac Morland <ijmorlan@uwaterloo.ca> wrote:On Mon, 20 Apr 2015, Paul Moore wrote:
On 20 April 2015 at 19:41, Barry Warsaw <barry@python.org> wrote:
tldr; type hints in python source are scary. Would reserving them for stub
files be better?
I think so. I think PEP 8 should require stub files for stdlib modules and
strongly encourage them for 3rd party code.
Agreed. I have many of the same concerns as Harry, but I wouldn't have
expressed them quite as well. I'm not too worried about actually
removing annotations from the core language, but I agree that we
should create a strong culture of "type hints go in stub files" to
keep source files readable and clean.
On that note, I'm not sure "stub" files is a particularly good name.
Maybe "type files" would be better? Something that emphasises that
they are the correct place to put type hints, not a workaround.
How about "header" files?
(ducks...)
Isaac Morland CSCF Web Guru
DC 2619, x36650 WWW Software Specialist
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/hjwp2%40cantab.net
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival