Hacker Newsnew | past | comments | ask | show | jobs | submit | alfons_foobar's commentslogin

> added random blank lines and deleted others from code that was not even in the file they were supposed to be working in.

Maybe some kind of auto-formatter?


That is my charitable interpretation, but it's always one or two changes across a module that has hundreds, maybe thousands of lines of code. I'd expect an auto-formatter to be more obvious.

In any case, just looking over your own PR briefly before submitting it catches these quickly. The lack of attention to detail is the part I find more frustrating than the actual unnecessary format changes.


Why would you are about blank lines? Sounds like aborted attempts at a change to me. Then realizing you don’t need them. Seeing them in your PR, and figuring they don’t actually do anything to me.

More likely artifact of debug prints being removed.

Agree that "splitting for splittings' sake" (only to stay below an arbitrary line count) does indeed not make sense.

On the other hand I often see functions like you describe - something has to be executed step-by-step (and the functionality is only used there) - where I _whish_ it was split up into separate functions, so we could have meaningful tests for each step, not only for the "whole thing".


How about "splitting for comprehension's sake"?

If I have a huge function, and I can peel parts off into sensible well-encapsulated sub-functions, and I name them well, then my ability to comprehend the whole goes up.

If I do that, future me will thank me, because I will almost inevitably be back to that function at some point.

But for this to work, the sub-functions have to really do what they say, and not do anything more. I have to be able to trust that I can understand them by just their name and arguments.


I ran into some code recently where this pattern caused me so much headache - class A has an attribute which is an instance of class B, and class B has a "parent" attribute (which points to the instance of class A that class B is an attribute of):

  class Foo:
      def __init__(self, bar):
          self.bar = bar
  
  class Bar:
      def __init__(self, foo):
          self.foo = foo
Obviously both called into each other to do $THINGS... Pure madness.

So my suggestion: Try not to have interdependent classes :D


Well, at times having a parent pointer is rather useful! E.g. a callback registration will be able to unregister itself from everywhere where it has been registered to, upon request. (One would want to use weak references in this case.)


Fair point!

Maybe I am just a bit burned by this particular example I ran into (where this pattern should IMO not have been used).


Agreed that this "hack" is very ugly!

On the other hand, I tend to take it as a hint that I should look at my module structure, and see if I can avoid the cyclic import (even if before adding type hints there was no error, there still already was a "semantic dependency"...)


He explicitly mentioned RAID0 though :)


This sounds intriguing and terrible at the same time :D


This 100%


The formatter already exists, my understanding is that this is merely an alias for "uvx ruff"...


> I think there's a distinction between worst-case and adversarial behavior.

I think _technically_ there is no difference - it does not matter if the worst-case-behavior is triggered by an "adversary" or by chance.

It _does_ give a different mental model though.


Why is it that regular git hooks do not work with claude code?


When using Claude Code cloud, in order to create signed commits, Claude uses the GitHub API to create commits instead of the git CLI


Huh, I had not heard of claude code cloud before.

(Also almost swallowed my tongue saying that out loud)


Wdym Claude Code cloud? Like in a cloud env?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: