Live data from Hacker News

I'm switching to Python and actually liking it

cesarsotovalero.net

621–630 of 718 posts

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

#621
post #45

From what I was told, Python was originally seen as a Swiss Army knife for sysadmins. It started gaining more traction when Canonical adopted it as the main language for Ubuntu 4.10 in 2004. Then, in 2005, Guido van Rossum was hired by Google to work on Google Cloud. That opened the door for wider adoption in academia, since Python had strong math libraries and integrated well with tools researchers were already usin…

I'd say the switch was learning that Google Search was written in Python (remember when error pages URL were in .py ?), and Youtube rewritten in Python. After that, reddit and dropbox followed (and later Instagram).

Apple also added Python in, I think, Mac OS X Jaguar, so it blipped on the radar.

When you have big players using it, the community automatically grows.

Django was the continuity of that and definitely contributed to the growing popularity of Python, but I think the hype started way before (and in fact we had to suffer Zope/Plone/Twisted for it :)).

Another decisive date was circa 2010 when the Belgian book "learn programming with python" came out. Granted, Django was already 5 years old at the time, but it brought many beginners who knew nothing about programming at the time.

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

#622
post #45

From what I was told, Python was originally seen as a Swiss Army knife for sysadmins. It started gaining more traction when Canonical adopted it as the main language for Ubuntu 4.10 in 2004. Then, in 2005, Guido van Rossum was hired by Google to work on Google Cloud. That opened the door for wider adoption in academia, since Python had strong math libraries and integrated well with tools researchers were already usin…

This aligns with what I remember and Guido going to Google explains things. Mid 2000's was all about PHP (Cake/Symphony/CodeIgniter/etc) vs Ruby (Rails) in the open source world. I remember hearing about Python only in sysadmin work and Plone. Then, suddenly were suddenly a lot of articles from Google about just about everything, all in Python. I remember saying to a coworker, "Google is single-handedly keeping Pytho…

Guido's passion and leadership were the driving force behind Python. A lot of smart people aligned with his vision.

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

#623

Earlier quoted context omitted.

This makes a lot of sense, I got to a similar conclusion in my other reply. I always thought the appeal of functional programming was more about test-ability and concurrency, it never occurred to me that people actually preferred the syntax.

Can't speak for anyone else, obviously, but part of the reason that I got into functional programming is specifically because I found the syntax very expressive. I felt like I was able to directly express my intent instead of describing a sequence of steps and hope that my intent comes to fruition. Different strokes and whatnot, not everyone likes functional programming and of course there are valid enough criticisms…

> Haskell doesn't really have "loops"

weeell, you can still do stuff like this in Haskell:

     import Data.Vector.Mutable
     ...
     let n = length vec
     forM_ [0 .. n-1] $ \i -> do
       next 
it's just in many cases the functional machinery is so accessible that you don't need to reach for for-loops.

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

#624

Earlier quoted context omitted.

Python is a language that the standard lib is big enough that you don't need dependencies

Technically, C or assembly also fulfill this "requirement". There seems to very few smart people who agree with this in practice, however.

Am I missing an obvious joke? C and assembly have no batteries included.

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

#625

Earlier quoted context omitted.

I hear about it every now and again and I can't seem to grok the benefit. What's the killer feature over make?

First, I grok make. I'm saying this from a position of familiarity, not of ignorance and fear. Make is great at compiling code in languages that don't have bespoke build systems. If you want to compile a bunch of C, awesome. For building a Rust or JavaScript project, no way. Those have better tooling of their own. So for the last 15 years or so, I've used make as a task runner (like "make test" shelling out to "cargo…

I don't really like Make as a build system, especially since today every language I've worked with has a much better one - cargo, uv, cmake, bazel, others.

My thing is that it's ubiquitous and if you stay simple, the syntax is perfectly readable; if you're doing anything complicated, I'll argue you don't want your logic in a Makefile anyway, you want it in a shell script or a Python script.

I get that if you want to do really complicated things, Just can be more ergonomic. But I haven't seen any real argument that it's more ergonomic, or understandable, or worth the learning curve, when your Makefiles are simple or have actual scripts doing the complicated stuff.

`just --list` is indeed missing (though I hear make is adding a --print-targets flag), but I usually need to run the same commands - make run, make test, make typecheck, make lint, make format. Note how none of these take an argument - that's also something I've never found myself needing.

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

#626

Earlier quoted context omitted.

Poetry has been decent for years. uv is new but great and will likely continue to be.

uv is soooo much faster than Poetry, especially for dependency resolution.

I would like to try uv, but I don't find Poetry that bad for dependency resolution times. If I have to wait 2 minutes once a week it's not the end of the world. Maybe if you're constantly installing new things that are tough to resolve it's an issue.

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

#627
post #319

Earlier quoted context omitted.

Oddly enough, "except" variables don't remain bound! try: x = int('cat') except Exception as e: pass print(e) # So, it appears Python actually has three variable scopes (global, local, exception block)?

Exception blocks don't create a different scope. Instead, the name is explicitly (well, implicitly but deliberately) deleted from the scope after the try/except block runs. This happens because it would otherwise produce a reference cycle and delay garbage collection. https://stackoverflow.com/questions/24271752 https://docs.python.org/3/reference/compound_stmts.html#exce...

This is the type of things that make me roll my eyes at all the wtf JavaScript posts[0], yes there are a lot of random things that happen with type conversions and quite a few idiosyncrasies (my favourite is that document.all is a non empty collection that is != from false but convert to false in an if)

But the language makes sense at a lower level, scopes, values, bindings have their mostly reasonable rules that are not hard to follow.

In comparison python seems like an infinite tower of ad-hoc exceptions over ad-hoc rules, sure it looks simpler but anywhere you look you discover an infinite depth of complexity [1]

[0] and how half of the complaints are a conjugation of "I don't like that NaNs exist

[1] my favourite example is how dunder methods are a "synchronized view" of the actual object behaviour, that is in a + b a.__add__ is never inspected, instead at creation time a's add behaviour is defined as its __add__ method but the association is purely a convention, eg any c extension type need to reimplement all these syncs to expose the correct behaviour and could for funzies decide that a type will use __add__ for repr and __repr__ for add

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

#628
post #459

Earlier quoted context omitted.

> They didn’t upgrade the moment uv came into existence. There's also projects that can't use `uv` because it doesn't like their current `requirements.txt`[0] and I have no bandwidth to try and figure out how to work around it. [0] We have an install from `git+https` in there and it objects strongly for some reason. Internet searches have not revealed anything helpful.

If you open even a brief issue and tag me @zanieb I'm happy to take a look!

Ta, will give that a go when I've got some free time.

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

#629

Earlier quoted context omitted.

uv is soooo much faster than Poetry, especially for dependency resolution.

I would like to try uv, but I don't find Poetry that bad for dependency resolution times. If I have to wait 2 minutes once a week it's not the end of the world. Maybe if you're constantly installing new things that are tough to resolve it's an issue.

Not the end of the world but why wait 2 minutes when you can wait 2 seconds?

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

#630
post #38

Earlier quoted context omitted.

Python 2 was removed in Monterey 12.3, which was incredibly stupid and disruptive as it caught everyone by surprise. We all knew Apple said they would remove it, but everyone was expecting them to be sensible and do it on a new major OS release, like they did with PHP, not mid-cycle. https://developer.apple.com/documentation/macos-release-note... I wonder if that kerfuffle is why they ended up not removing Ruby and P…

> [Software that was officially EOL and no longer supported by the developer as of January 1, 2020 — even though they went back on that with an emergency patch in April] was removed in [an OS released on October 25, 2021], which was incredibly stupid and disruptive as it caught everyone by surprise [despite the fact that the intent to EOL that software was declared many years ahead of time, and that sunset date alrea…

> I will never understand this.

Perhaps because your interpretation of my comment is wrong.

> was removed in [an OS released on October 25, 2021]

No, no it was not! That would have been fine. Heck, it would even have been fine if they had removed it the year before. Two years. Three. I don’t care. The problem is that it was removed on a point release (not October) without warning, after setting the precedent of removing another language on a major release.

> But then, I've been using Python 3 since 3.2 and my first reaction to that was a sigh of relief

And I don’t even care about Python. But I still had to deal with the fallout from that from things I didn’t write.

Post reply on HN