Talk:Practical numbers: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 54: Line 54:


: '''You chose not defend your insistence on using Haskell typing in a Python example'''. Rosetta code readers expect Python in the Python section. Adding Haskell type comments detracts from this, (Oh quick call them a vandal as my case is too weak). --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 10:44, 31 March 2021 (UTC)
: '''You chose not defend your insistence on using Haskell typing in a Python example'''. Rosetta code readers expect Python in the Python section. Adding Haskell type comments detracts from this, (Oh quick call them a vandal as my case is too weak). --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 10:44, 31 March 2021 (UTC)

:: "your insistence on using Haskell typing "
:: No. I'm not using typing '''at all'''. I don't find it helpful in small Python scripts.
:: I do find type comments helpful. They are not "Haskell" – they are in a language-independent format (MH) which I find clean and informative.
:: My comments are not your business.
:: Deletion is not the Rosetta way. The Rosetta way is the addition and comparison of alternative approaches. [[User:Hout|Hout]] ([[User talk:Hout|talk]])


==*Kick*==
==*Kick*==

Revision as of 11:06, 31 March 2021

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, and their notational requirements differ.

The content of a comment is not part of the syntax of a language. Hence your attempt to fudge the language with talk of "python format" (sic). (I think you may find that that is what a layout program contributes).

Hindley Milner notation is not "Haskell". It is a language-independent representation of the semantics of types in general, which proves clean and expressive in a variety of contexts. I find these comments very helpful to my clarity as I sketch and compose my functions.

Let us consider an example:

You have angrily deleted, with intemperate submission tags, what seems to me a clear and informative comment:

# sumOfAnySubset :: [Int] -> Int -> Bool

and replaced that comment (in a short script which probably doesn't benefit much from compiler type hints anyway) with a formal type hint which, for the human reader, is noisier and less informative:

sumOfAnySubset(xs: List[int]) -> Callable[[Any], Any]

I rest my case. "Callable" is not needed by the human reader, who is simply aiming for mental clarity, and "Any" provides less information than Int.

The comment is more legible and helpful for the human, the type hint is more helpful (we hope) to the compiler.

It would be entirely possible, depending on what we are optimising for, to have both.

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, overwriting and deleting with shouty comments, are gratuitous, and very damaging not only to Rosetta Code, but frankly, also to you.

I'm afraid that this addiction to intemperate deletion and vandalism is again approaching the point where it will merit active disciplinary attention. Try to get some help outside Rosetta Code. It is clearly not the fount or origin of your difficulties. Hout (talk) 10:18, 31 March 2021 (UTC)

You chose not defend your insistence on using Haskell typing in a Python example. Rosetta code readers expect Python in the Python section. Adding Haskell type comments detracts from this, (Oh quick call them a vandal as my case is too weak). --Paddy3118 (talk) 10:44, 31 March 2021 (UTC)
"your insistence on using Haskell typing "
No. I'm not using typing at all. I don't find it helpful in small Python scripts.
I do find type comments helpful. They are not "Haskell" – they are in a language-independent format (MH) which I find clean and informative.
My comments are not your business.
Deletion is not the Rosetta way. The Rosetta way is the addition and comparison of alternative approaches. Hout (talk)

*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)
"should not be encouraged" is a strange but illuminating phrase (I ignore your silly, tiresome and obdurate characterisation of my Python comments as "Haskell" :-)
May I ask, where exactly in Rosetta Code's landing-page statement of its goals do you read an incitement to "encourage" or "discourage" particular styles of coding ?
That would seem an oddly aggressive and fruitless attack on the intention to "aid a person with a grounding in one approach to a problem in learning another".
Are you hoping to change the goals of Rosetta Code ? Do you disapprove of them ? It's getting harder and harder to avoid that impression.Hout (talk) 10:47, 31 March 2021 (UTC)


If code doesn't run, or solve the task, or contains problems flagged up by a widely used linter, then let's point that out to each other, and perhaps suggest solutions.
Any other divergences are opportunities, not threats.
Where approaches differ, we learn. I already notice that you have learned some things from my code. Things which you would have missed if you had succeeded in stamping it out at the beginning, as you were clearly (though a little puzzlingly) hell-bent on doing. Hout (talk) 10:54, 31 March 2021 (UTC)