🇨🇦 tunetardis

  • 1 Post
  • 117 Comments
Joined 2 years ago
cake
Cake day: June 11th, 2023

help-circle




  • This makes me think of my late grandfather. He had been a civil engineer for the US Navy who spent several years working in the Panama Canal Zone. He told me this story of a senator showing up one day with cost-cutting on his mind. He focused on one line in the budget: mosquito control. “Mosquitoes? There are no mosquitoes here! What a colossal waste of money!” The whole area became pretty much unliveable within a year of his returning to Washington.




  • Thanks, it makes me feel relieved to hear I’m not the only one finding it a little overwhelming! Previously, I had been using chatgpt and the like where I would be hunting for the answer to a particularly esoteric programming question. I’ve had a fair amount of success with that, though occasionally I would catch it in the act of contradicting itself, so I’ve learned you have to follow up on it a bit.


  • I turned on copilot in VSCode for the first time this week. The results so far have been less than stellar. It’s batting about .100 in terms of completing code the way I intended. Now, people tell me it needs to learn your ways, so I’m going to give it a chance. But one thing it has done is replaced the normal auto-completion which showed you what sort of arguments a function takes with something that is sometimes dead wrong. Like the code will not even compile with the suggested args.

    It also has a knack for making me forget what I was trying to do. It will show me something like the left side picture with a nice rail stretching off into the distance when I had intended it to turn, and then I can’t remember whether I wanted to go left or right? I guess it’s just something you need to adjust to. Like you need to have a thought fairly firmly in your mind before you begin typing so that you can react to the AI code in a reasonable way? It may occasionally be better than what you have it mind, but you need to keep the original idea in your head for comparison purposes. I’m not good at that yet.







  • That’s the point, when programming with immutable structures you always pass the mutability onto the enclosing structure.

    I guess the point I was trying to make here was if the data type is already mutable, there is no point in sticking it in a list just so you can replace a reference with an identifier. You’re just adding an extra level of indirection. But sure yeah, if the type is inherently immutable, you have to do something.

    A list is an antipattern here IMO. Just wrap it in some dedicated object (see e.g. Java’s StringBuilder).

    Interesting. I’m not aware of anything like StringBuilder in the standard library for either Python or JavaScript. Looks like it wraps a list of characters and tries to behave as string-like as possible? You could presumably write your own class like that or download an implementation from someplace.

    I guess in most cases in my own code, where I need a mutable string is usually as part of a larger data structure which is the thing that gets passed around by reference, so it’s easy enough to replace a field within that.

    For building up a string, I would tend to use an io.StringIO in Python with file-writing calls, but those aren’t meant for sharing. What you don’t want to do is use the += operator a lot on strings. That gets expensive unless strings are mutable (like they are in say C++'s std::string).




  • I think if there’s a silver lining to the 100% tariffs on Chinese EVs in North America, it is that it will hasten adoption of ebikes, which imo solve more problems than EVs in any case.

    His point that ebikes replace cars—not conventional bikes—tracks for me. Mine has basically replaced our second car and I use it, as he indicated most people do, for commutes and short errands.

    His point that an ebike has an energy footprint comparable to a 4000 mpg ICEV is an incredible metric. I wonder where he pulled that from? I know that my ebike battery has 1/150th the capacity of what goes into a Tesla. Granted, I wouldn’t expect a comparable range so there’s a bit of apples to oranges there. But if you then work in that EVs are already much more energy efficient than ICEVs, I guess you could arrive at a number like 4000.

    Whatever the case, my experience with ebikes is that they are pretty close to free transportation in terms of operating costs. There may be a few unexpected expenses beyond the initial sticker cost of the bike in terms of accessories (particularly high quality locks) and some winter gear if you’re in a colder climate, but those are one-time purchases for the most part.


  • My brother told me this story of the raccoons living in his backyard. The mother had figured out how to defeat a new supposedly raccoon-proof garbage can and lined up the cubs to demonstrate. The first two watched with rapt attention while a third had a kind of dazed look. The mother then came back and smacked him in the head before showing them again. That seems like a pretty good indication to me that she had a good grasp of the mental state of her cubs?