random...@fastmail.us wrote: > On Mon, Jan 26, 2015, at 19:11, Steven D'Aprano wrote: >> random...@fastmail.us wrote: >> - lexical analysis has to look for twice as many files (it has to >> hit the hard drive for a stub file before looking at the source), >> and we know from importing that file system access is a >> significant and expensive part of the process. > > The idea is that the type hinting files would not participate in > execution at all, only static analysis, so the interpreter doesn't need > to look for these things at all, it only needs to ignore them.
Yes, but the *type-checker* needs to look for all those files, which slows the type-checker down. My estimate of time savings, plucked completely from thin air, is that type-checkers will save around 5% time by not using a separate stub file. (Anyone actually using MyPy care to measure it?) Of course, that will differ according to circumstances: a stub file on a slow CD/DVD media mounted over the network will be much more expensive than a stub file on a RAM disk or SSD drive. Regardless of exactly how much more expensive it is, two sets of file I/O by definition will be more expensive than one set of file I/O. But really, this is the minor point against header files. The icing on the cake, not the cake itself. The big reason for avoiding them is dependency management and the splitting of information about a single thing into two files. -- Steven -- https://mail.python.org/mailman/listinfo/python-list