🇨🇦 tunetardis

  • 0 Posts
  • 37 Comments
Joined 2 years ago
cake
Cake day: June 11th, 2023

help-circle



  • I see what you’re getting at here. The solar constant is the solar constant. If you’ve got a perfect angle to the sun, you should be getting the same amount of power regardless of latitude. I mean I suppose it’s possible there might be a slight attenuation with the sun at a lower angle due to there being more atmosphere to traverse? Otoh solar panels don’t function as efficiently at high temperatures, so it’s possible they may be more efficient in some cases.

    But you have to consider that averaged out, you’re looking at shorter daylight hours overall at high latitudes, even if there are periods in mid-summer when days can be super long, so that’s a consideration. So yes, the panels should pull in similar amounts of power while the sun is up, but it’s not up as much.
















  • 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).