Talk:Evaluate binomial coefficients: Difference between revisions

Line 128:
: The RC user could install the Python3 version of '''mypy''' and run a type check which did use them, but would that be worth their while ? How many would do that ?
 
: The use of parseable type hints rather than comments introduces a '''larger surface for bugs''':
::Donald's first draft conflated the type of two functions which in fact had quite different type signatures, as had been clearly shown in the type comments which he deleted.
::His 'fix' of that bug introduced another bug, which created a Python3 compiler error (choking on a redundant square bracket)
::Once that compiler error was removed, an actual test with '''mypy''' revealed no errors in the code itself, but found more than one in the type hints (now fixed). To correct these, and to supply hints for functions over (or returning ) lists of items of various types, two additional symbols had to be imported from the typing module.
 
: For the human reader whose HM comments have been deleted, the parseable type hints to the '''mypy''' checker have a '''poorer signal to noise ratio'''. Cognitively redundant 'Callable' names are multiply inserted where HM needs none, each also bringing 4 additional square brackets. In some instances type names require lower case, in others upper case. The simply polymorphic HM `a` (any type) is replaced by the more verbose '''Any''' (or even '''typing.Any''')
 
: Increased bug counts for no actual checking by Python3 itself seems an unattractive deal to me. The 'nativist' argument for them (a purer Python accent – why adopt the broadly used Hindley Milner comments when our native Python allows actual type hints ?) makes no distinction between benefits to the reader with benefits to the compiler.
Line 146:
: Nice idea, but perhaps doesn't yet survive experiment, or actually benefit RC readers ? Maybe when Python4 comes ? [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 08:55, 24 February 2019 (UTC)
 
:: Donald [[User:Paddy3118|Paddy3118]]. Do feel free to introduce type hints into your own code - but please desist from deleting my type comments and replacing them with these hints. They damage the legibility of the code, demonstrably expand the surface for bugs, and in Python3, offer no benefit whatsoever to the compiler [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 09:02, 24 February 2019 (UTC)
9,655

edits