Live data from Hacker News

I'm switching to Python and actually liking it

cesarsotovalero.net

201–210 of 718 posts

Re: I'm switching to Python and actually liking it

#201

I've avoided Python for a long time, but I'm getting roped in myself, mainly because certain tasks seem to require a lot less code than Java or Perl. That said, call me old-fashioned, but I really take issue with "curl $URL | bash" as an installation method. If you're going to use an install script, inspect it first.

If your going to execute the code anyway, you either have to inspect everything or trust whoever is providing it. There is nothing special about bash that makes it more dangerous to execute than python.

Re: I'm switching to Python and actually liking it

#202

Earlier quoted context omitted.

> it's obvious that they are magic methods and not intended to be part of the public API Is there an alternative API? No. This is public API regardless of anyone's intentions. Though "it's weird" is really not a very strong argument against it.

There are private and public methods. Private methods are only supposed to be called within other methods, as in privately. Public methods are the ones that are normally called through the code, repl, by the user or whatever. You are not supposed to write `myclass.__add__(x)` anywhere except where you define the class itself and its methods.

There's actually 4 kinds:

  def foo(... # public
  def _foo(... # internal
  def __foo(... # munged
  def __foo__(... # magic
Internal is more convention as the language doesn't really do anything with it, but it does with munged, and magic methods are specifically for things implemented in the language.

Internal and munged don't exactly map to private and protected, but are kinda similar ish.

Re: I'm switching to Python and actually liking it

#203
post #163

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

Yes, I'd say Python's crown as the go-to lightweight scripting and web development language was mostly ceded to JS. It's still reigning champion of data science, and of course it has a huge number of uses and users still around, but it's not really cool or in vogue outside of those circles.

Python has never been THE web development language, that's always been JavaScript. Python is one of the more popular server-side languages, and JavaScript has move from frontend to backend in the last decade too. Not sure whether this has really taken the crown of any backend-language.

And what is lightweight scripting? Isn't scripting by definition lightweight?

But Python overall is still very popular outside the Data Science-circles. Not sure where this claim is coming from.

Re: I'm switching to Python and actually liking it

#204

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

Apparently the author used to be a Java person. I have this feeling - or prejudice - that people still in the Java World are a bit out of tune with the tech industry, working on huge legacy projects on big retail or US banking. These people tend to be conservative and resistant to change, so maybe that's where these types of articles are coming from.

I gave a talk recently at a conference about how modern Java doesn’t suck very much, and that the worst part of Java is Java developers, who seem to be completely intellectually unambitious.

I don’t think Java makes anyone unambitious, I think it’s that Java is taught in schools and unambitious people don’t feel the need to learn anything else, and they get jobs at unambitious corporations. It selection-biases towards unambitious people who don’t want to learn more than they have to.

Compare this to something like Clojure or Haskell or something, which isn’t routinely taught at schools and is not very employable. People who learn these languages generally seek out these things because they’re interested in it. This selection-biases towards intellectually ambitious people.

As a result, Java people can be insufferable for people like me.

The people who make Java have actually made the platform and language pretty ok in the last two decades, but I had to fight at a previous job to use NIO, which I think was introduced in Java 4, but none of my coworkers had really heard of it or used it because the regular Java blocking IO has been “good enough”.

Re: I'm switching to Python and actually liking it

#205

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

> Is this just junior devs who never learned it Seems more like it's fallen out of favor with senior devs who have moved to Go/Rust.

I don’t know anything about go. But Rust is more of a competitor to C and C++, right? It is sort of bizarre if these languages are butting heads with a scripting language like Python.

Python compares fairly well to Bash or JavaScript or whatever, right? (Maybe JavaScript is better, I don’t know anything about it).

Re: I'm switching to Python and actually liking it

#206

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

Apparently the author used to be a Java person. I have this feeling - or prejudice - that people still in the Java World are a bit out of tune with the tech industry, working on huge legacy projects on big retail or US banking. These people tend to be conservative and resistant to change, so maybe that's where these types of articles are coming from.

I have a related feeling or prejudice that people not in the Java World view their corner as "the tech industry" without realizing that they are living in a village compared to the giant metropolis that is the Java World.

Java programmers may not blog as much, and Java doesn't show up on Hacker News as much, but not being Extremely Online does not mean that it isn't extremely widely used by real people whose experiences are just as valid.

Re: I'm switching to Python and actually liking it

#207

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

Apparently the author used to be a Java person. I have this feeling - or prejudice - that people still in the Java World are a bit out of tune with the tech industry, working on huge legacy projects on big retail or US banking. These people tend to be conservative and resistant to change, so maybe that's where these types of articles are coming from.

Java shops are certainly where I've witnessed the most disdain for Python. IME the strongest feelings tend to come from people who didn't actually have any significant experience with Python, and perhaps don't even have much practical experience with any language that isn't Java. So they tended to consider it to be objectively inferior purely because it's interpreted and dynamically typed.

At a previous job I did manage to put a chip in that when I demonstrated replacing one of our Java services with a Python implementation. It was a fraction of the code, and achieved much better latency and throughput. Obviously not every Python program is going to do that. But my point isn't that Python is better, it's that these kinds of things are never so cut-and-dried. Many non-trivial Python programs are just thin shells around a large core of very well-optimized and battle-tested C/C++/Rust code. And Java, for its part, can also accumulate a lot of dynamic language-style performance losses to pointer chasing and run-time type lookups (and GC churn) if you're not careful about how you use generics. As always, the devil's in the details. It's also less able to pull the "actually I'm a C++" trick because using a compacting garbage collector makes it difficult to interop with native code without paying a hefty marshaling tax.

Re: I'm switching to Python and actually liking it

#208

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

When it got big enough that companies were forcing people to learn it. People automatically hate things they didn't choose themselves.

Plus there has been a rising sentiment against dynamic typing by masochists over the last decade or so.

Re: I'm switching to Python and actually liking it

#209
post #8

Python as a language is nice. Python's version and package management is nothing short of a nightmare.

Using a nix devshell has worked out well for scripts for me so far. I haven't figured out what that workflow is like for larger projects though. I'm not interested in learning Uv

As a nix user, you hardly need to know uv, but you might later need to know how to work together with non-nix-users who use uv. It's easy.

There will be a file: uv.lock You can use uv2nix to get a single nix package for all the project's python dependencies, which you can then add to your devshell like anything else you find in nixpkgs (e.g. right alongside uv itself). It ends up being two or three lines of code to actually get the package, but you can just point a LLM at the uv2nix docs and at your flake.nix and it'll figure them out for you.

Your devshell will then track with changes that other devs make to that project's dependencies. If you want to modify them...

   edit pyproject.toml # package names and versions
   uv lock             # map names and versions to hashes (nix needs hashes, finds them in uv.lock)
   nix flake lock      # update flake.lock based on uv.lock
   nix develop         # now your devshell has it too
This way you're not maintaining separate sources of truth for what the project depends on, and the muggles need not think about your nix wizardy at all.

Re: I'm switching to Python and actually liking it

#210

Earlier quoted context omitted.

Bizarre is that you don’t consider it ugly. Kotlin: constructor is either part of class definition or keyword constructor. Ruby: initialize JS: constructor Python: ______new______, _______init_______ Literally this meme: https://knowyourmeme.com/memes/three-headed-dragon

I have found to believe that ugly and beautiful are irrelevant. As long as it's doing the job and not cause major headaches. Life is too short to worry about syntax.

> Life is too short to worry about syntax.

Every programming language you use will annoy you in some way. You stop caring after a few of them.

Post reply on HN