Talk:Practical numbers

From Rosetta Code
Revision as of 10:36, 31 March 2021 by rosettacode>Paddy3118 (→‎*Kick*: Misplaced.)

Python: Comment on type hints for the functional example

− Hout Wrote:

Clarity about the return type semantics, is however, very useful when reasoning about pure functions, and my personal approach is to add light informal comments about the type, in a Hindley Milner idiom, which lends itself well to brief and clean notes on the type of curried functions, which are more easily composable, especially with higher order functions, and which I generally prefer to use.

I've been asked (always by the same person :-) why I don't find the idiom of Python compiler type-hints a good match for my semantic type comments, and the answer is essentially that the compiler type hints are not a clear or helpful notation for this purpose – not just because they generally involve more typing and visual noise, but also, and in particular, because with curried functions the compiler hint notation becomes swamped by use of the cognitively redundant `Callable` keyword, which degrades clarity, and imposes burden, for the human reader.


I replaced misleading Haskell-language type comments by Python typing checked with MyPy. Python can add typing in comments as part of the language and that too is not the Haskell that was replaced.
--Paddy3118 (talk) 09:17, 31 March 2021 (UTC)

Comments are for the reader not the compiler. My comments provide the reader with information which is both less noisy, and more specific, than the uses of the Callable and Any keywords in the compiler hints.
I quite understand that our approaches differ, and the contrast adds to the value of Rosetta code, as defined on the landing page
Deleting informative comments is gratuitous, and inconsistent with the goals of Rosetta code, and removes value without adding any. There is a name for this. Hout (talk) 09:36, 31 March 2021 (UTC)
Python although a language spec. is commonly referred to as being an interpreter as its overwhelming implementaton, CPython is an interpreter. Python does allow types as comments in its format. Haskell typing is not Python typing. Your Haskell comments are at odds with the typing of Python, as you do not defend. --Paddy3118 (talk) 10:09, 31 March 2021 (UTC)

Oh dear ... what is this addiction to angry vandalism ?

Comments for the human serve a different purpose to syntactic hints for the compiler, and carry different type of information. There is no need to confuse them. The content of a comment is not part of the syntax of a language.

We can disagree on this – that's fine – but when our approaches differ, we contribute alternative versions. This enriches Rosetta Code.

Vandalistic attempts to prune Rosetta back to one Truth and one Way, vandalising and deleting with shouty comments, are gratuitous, and very damaging to Rosetta Code. I'm afraid that they are again approaching the point where they will merit active disciplinary attention. Hout (talk) 10:18, 31 March 2021 (UTC)

*Kick*

Paddy3118, on your user page, you write: (Kick-me if I seem impolite) --Chunes (talk) 10:26, 31 March 2021 (UTC)

Repeated attempts to pass of Haskell as Python should not be encouraged. Hout has had many polite explanations that he chooses to ignore. I have translated his Haskell to Python type annotations in this case. Hout prefers the Haskell. This is a Python example. Your kick is misplaced. --Paddy3118 (talk) 10:36, 31 March 2021 (UTC)