• 2 Posts
  • 18 Comments
Joined 1 year ago
cake
Cake day: June 18th, 2023

help-circle
  • The whitespace doesn’t bother me at all, but holy hell! Any time I’m trying to understand a Python program/library that’s anything above a couple thousand lines of code, I instantly feel a burning hate for dynamic typing.

    I love Python for scripting- in large part because of dynamic typing. IMO it’s just not a language made for building large infrastructures.



  • For someone starting out, I would say that a major advantage of Python over any compiled language is that you can just create a file and start writing/running code. With C++ (which I’m also a heavy user of) you need to get over the hurdle of setting up a build system, which is simple enough when you know it, but can quickly be a high bar for an absolute beginner. That’s before you start looking at things like including/linking other libraries, which in Python is done with a simple import, but where you have to set up your build system properly to get things working in C++.

    Honestly, I’m still kind of confused that the beginner course at my old university still insists on giving out a pre-written makefile and vscode config files for everyone instead of spending the first week just showing people how to actually write and compile hello world using cmake. I remember my major hurdle when leaving that course was that I knew how to write basic C++, I just had no idea how to compile and link it when I could no longer use the makefile that we were explicitly told to never touch…


  • Yes, it’s a field. Specifically, a field containing human-readable information about what is going on in adjacent fields, much like a comment. I see no issue with putting such information in a json file.

    As for “you don’t comment by putting information in variables”: In Python, your objects have the __doc__ attribute, which is specifically used for this purpose.


  • My test suite takes quite a bit of time, not because the code base is huge, but because it consists of a variety of mathematical models that should work under a range of conditions.

    This makes it very quick to write a test that’s basically “check that every pair of models gives the same output for the same conditions” or “check that re-ordering the inputs in a certain way does not change the output”.

    If you have 10 models, with three inputs that can be ordered 6 ways, you now suddenly have 60 tests that take maybe 2-3 sec each.

    Scaling up: It becomes very easy to write automated testing for a lot of stuff, so even if each individual test is relatively quick, they suddenly take 10-15 min to run total.

    The test suite now is ≈2000 unit/integration tests, and I have experienced uncovering an obscure bug because a single one of them failed.


  • This is a very “yes but still no” thing in my experience. Typically, I find that if I write “naive” C++ code, where I make no effort to optimise anything, I’ll outperform python code that I’ve spent time optimising by a factor of 10-30 (given that the code is reasonably complex, this obviously isn’t true for a simple matrix-multiplication where you can use numpy). If I spend some time on optimisation, I’ll typically be outperforming python by a factor of 50+.

    In the end, I’ve found it’s mostly about what kind of data structures you’re working with, and how you’re passing them around. If you’re primarily working with arrays of some sort and doing simple math with them, using some numpy and scipy magic can get you speeds that will beat naive C++ code. On the other hand, when you have custom data structures that you want to avoid unnecessarily copying, just rewriting the exact same code in C++ and passing things by reference can give you massive speedups.

    When I choose C++ over python, it’s not only because of speed. It’s also because I want a more explicitly typed language (which is easier to maintain), overloaded functions, and to actually know the memory layout of what I’m working with to some degree.





  • That would be fine, I can live with choosing two of those for any given account.

    What I hate is when the company offering the service forces its choice on me. I may be reliant on logging into some specific account without access to my phone, but then along comes company X and says “NOPE! Your account security is more important than you being able to access your own stuff. We’re completely on board with locking you out of your own accounts in the name of security.”

    To be clear, I’m talking about personal accounts. Those on a network where I’m responsible for preventing a breach are another matter of course.


  • I’m surprised you’re getting downvoted so heavily: Is it really that controversial of an opinion that I want to be able to make the choice between reliable accessibility, efficiency, and hardened security for my personal stuff?

    Of course: On a corporate network I have a responsibility to have a very secure account so that I’m not a weak point, I’m not talking about scenarios where my account being breached exposes others that I’m responsible for.

    I’m talking about my personal accounts. I may want to choose to have a password and no 2FA, for the simple reason that I may want to be able to access my account from a library computer or internet cafe without having access to any of my devices. That reliable access may be more important to me than having heavier security, and nobody has any business asking me why, because it’s my data that I’m choosing how to protect. However, that’s become pretty much an impossibility by now, with everyone shoving 2FA and whatnot down my throat, regardless of what I want.

    If I happen to lose/break my laptop and phone simultaneously, which is not unthinkable given that I carry both on me pretty much every day, I’m pretty much locked out of everything.


  • Some languages - specifically Norwegian that I know of, don’t have separate words for “boyfriend” and “girlfriend”. In Norwegian we have the word “kjæreste” which can be directly translated to “dearest”. To me it always feels a little weird to use “boyfriend” or “girlfriend”, i guess the same could be true for other non-native english speakers.