6

I wasn't gone, I was just working.

Anyway, I had some fun and wrote a simple 10 minute little precursor to an ngram implementation:

(when your comments are as long as the code, lol)
https://pastebin.com/bZVh8YSP

It obviously doesn't do type checking, or valid value checking, or any of that, and there may be an old comment or two adding cruft but whatever

Comments
  • 7
    @atheist pretty normal code for a mathematician
  • 3
    @atheist thank you.

    Comments over docstrings have always just been a preference of mine.

    Why prefer 'if x is None' over equality testing?

    "you're slicing twice."

    Fuck, you're right. Can't believe I didn't catch that. Thanks.
  • 1
    @atheist very commendable
  • 1
    @atheist I believe you mean linTers?
  • 1
    @atheist I was shocked by the python string literal thing and looked it up. You should have mentioned that it‘s a comment (prefixed with #), not an actual string literal 😂
  • 0
  • 2
    OMG the sexual tension between the `w` and `stride` variables...
  • 0
    @atheist linters are workless since black. Does black also sort imports? Not sure
  • 1
    @atheist when I looked it up, it was

    def foo():
    # This is a docstring
  • 1
    @atheist My god… so it IS as retarded as you said originally. This is mind boggling!
  • 1
    @atheist you don‘t see any problem with it?
  • 0
    @atheist imo, comments and doc are not code, so they should be… comments.

    What if my function is supposed to simply return a string literal?
    Would this string also count as a documentation for the function?
    This seems insane. The doc and the returned value are completely different things.

    What’s the problem with comments? If it’s about multiline, then there should be syntax for multiline comments.
    Abusing string literals for that just because they support multiline is insane.
    And even if there is no multiline support for comments, I’d still prefer multiple lines prefixed with #.

    I also don’t get the point about retrospection. Why is it relevant for the runtime to be able to extract the docs for a function?
  • 1
    @atheist oh, thats cool and useful. Can't believe I didn't fucking know this before now.

    Thank you, thank you, thank you.
  • 0
    @atheist yes, I get it. It’s an unused string literal. I also get that there is no ambiguity.
    That doesn’t mean that I agree that it’s a good thing.

    It’s still arbitrary to use the first unused string expression or literal as the doc.

    And you haven’t given me an explanation yet for why this is better than a normal comment and why it’s good for the runtime to be able to have access to it.
    It’s not like there is a use case where I run the code and somehow want to get the docs for the functions that are executed. I want the docs when I write the code, not when I run it.

    > You are not a very good programmer, are you?
    Where does this suddenly come from?
  • 1
    @atheist you can stop your insults, your point about the repl has convinced me. That’s the kind of argument I was looking for.
  • 1
    @atheist it's kinda beautiful actually.
Add Comment