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

help-circle

  • I really do agree on all your points, so at the end of the day I think a lot comes down to use-case and personal preference.

    My primary use cases for Python are prototyping and as a frontend/scripting tool for software written in C/C++/Fortran. In those scenarios, spending significant time on type hinting and unittests defeats the purpose of using Python (blazing fast development).

    I’ve written/worked on only one larger code base in pure Python, and my personal opinion became that I heavily prefer strictly typed languages once the code base exceeds a certain size. It just feels so much smoother to work with when I have actual guarantees that are enforced by the language.

    With that said, we were a bunch of people that are used to using Python for prototyping that developed this larger library, and it would probably have gone a lot better if we actually enforced use of proper type hinting from the start (which we were not used to).


  • Type hints are usually great, as long as they’re kept up to date and the IDE interprets them correctly. Recently I’ve had some problems with PyCharm acting up and insisting that matplotlib doesn’t accept numpy arrays, leading me to just disable the type checker altogether.

    All in all, I’m a bit divided on type hints, because I’m unsure whether I think the (huge) value added from correct type hints outweighs the frustration I’ve experienced from incorrect type hints. Per now I’m leaning towards “type hints are good, as long as you never blindly trust them and only treat them as a coarse indicator of what some dev thought at some point.”


  • Then I absolutely understand you :)

    How common it is 100 % depends on the code base and what practices are preferred. In Python code bases where I have a word in decisions, all Boolean checks should be x is True or x is False if x should be a Boolean. In that sense, if I read if x or if not x, it’s an indicator that x does not need to be a Boolean.

    In that sense, I could say that my preference is to flip it (in Python): Explicitly indicate/check for a Boolean if you expect/need a Boolean, otherwise use a “truethiness” check.




  • Exactly as you said yourself: Checking falsieness does not guarantee that the object has a length. There is considerable overlap between the two, and if it turns out that this check is a performance bottleneck (which I have a hard time imagining) it can be appropriate to check for falsieness instead of zero length. But in that case, don’t be surprised if you suddenly get an obscure bug because of some custom object not behaving the way you assumed it would.

    I guess my primary point is that we should be checking for what we actually care about, because that makes intent clear and reduces the chance for obscure bugs.



  • I write a lot of Python. I hate it when people use “X is more pythonic” as some kind of argument for what is a better solution to a problem. I also have a hang up with people acting like python has any form of type safety, instead of just embracing duck typing.This lands us at the following:

    The article states that “you can check a list for emptiness in two ways: if not mylist or if len(mylist) == 0”. Already here, a fundamental mistake has been made: You don’t know (and shouldn’t care) whether mylist is a list. These two checks are not different ways of doing the same thing, but two different checks altogether. The first checks whether the object is “falsey” and the second checks whether the object has a well defined length that is zero. These are two completely different checks, which often (but far from always) overlap. Embrace the duck type- type safe python is a myth.






  • To be fair, I didn’t expect you to respond at all, and really just wanted to point out that calling a stranger you know nothing about a “dweeb” in response to something they wrote is a prime example of “just being a cunt to someone”. You didn’t need to respond, but you chose to do so by being a cunt.

    Regardless, I think you missed some of the sarcasm in what I was writing (which, in hindsight, isn’t very clear). My point isn’t that shitposting is some form of high art. It’s that it’s a form of humor that amounts to more than saying provocative stuff or being a cunt. At it’s best, a shitpost can even contain some social commentary in the same way as caricatures can. Of course, as with all other humor, there are plenty of bad shitposts out there too, which are often just trolls trying to stir up shit.



  • I’ll defend shitposting here, because I think you’re simplifying it a bit too much.

    Shitposting is so much more than “saying dumb stuff for shits n’ giggles”. First of all, as with anything else, there are good and bad shitposts. A good shitpost usually contains a solid undertone of irony or sarcasm. An important part of the humour is not just in “being dumb” it’s about using a statement that is dumb in a very specific way in combination with a specific context in order to create something funny.

    Furthermore, a good shitpost uses exaggeration in a good way. The reader should preferably be “lured into” the post, not realising it’s a shitpost, before the notch is turned to 11 revealing that it was a shitpost. This adds an extra layer of humor and social commentary: The fact that the post at first seems believable forces you to recon with what kind of things you would actually believe someone could write. It also makes the target of the humor clear.

    Shitposting may not be high art, but calling it “just being a cunt to someone” is missing the mark. “Just being a cunt to someone” is exactly that, and it’s not shitposting.





  • I think a lot of people here have it too black/white.

    Earning money by owning property doesn’t automatically make someone a leech. Sometimes, people want the option to live somewhere without needing to take on the responsibility/risk of tying down assets in a house. Often, it’s because you’re new in town and haven’t decided where to settle, or because you’re in a situation where you’re moving a lot, and don’t want to have to deal with buying/selling something worth a lot of money every time you move.

    In these kinds of situations, you can see renting as a situation where you’re paying someone for taking on the risk, responsibility, and maintenance costs of owning the infrastructure. At a proper price, this can be an absolutely fair deal, that doesn’t involve anyone being exploited.

    Note that I’m not defending the scalping assholes that exploit people who can’t afford to get into the housing market here. I’m simply pointing out that, even for someone who can afford to buy, there are legitimate reasons to rent, and renting out property at a fair price can absolutely be a decent practice that leaves everyone happy.