Live data from Hacker News

Python's pre-declared constants are kinda weird

sebsite.pw

81–90 of 234 posts

Re: Python's pre-declared constants are kinda weird

#81
Python has some absolutely kick-ass libraries, even without C. It has Django, for those of us who like developing web apps but never could fall in love with Ruby on Rails. And Django is amazing. I've also yet to see a better language for writing quick ETL scripts and pipelines. Also, an 'I need a script for $SYSADMIN_TASK but I want to be able to read it later.' Anything dominated by external latencies (web, databases, etc) will be fast enough for many uses in Python.

Sure, it's not a language to write a web browser or game engine in. And it is slow. But it has some very strong niches outside of ML/Data science. Personally, I love it. To each their own.

Re: Python's pre-declared constants are kinda weird

#82

Python is awful. There are so many one offs in libraries, none agree on a style, it’s slow, and it’s way too easy to do the wrong thing. I often work with data scientists and have to productionize their jupyter notebooks which is pure suboptimal hell. I guess it must be a good easy learning curve for research/scratchpad

When one writes jupyter notebooks for DS you are not writing python. If you ask 10 DSs explain to me what python's attribute lookup model is and why is it different from other OO languages like say Java or C++, they would not care about it. The only thing DSs care about is the rich DS Library support and fast speed of protoyping. To a DS using jupyter this is almost the same feedback loop as a type system at compile time.

Have you tried using `uv`'s newer tools? They help a lot e.g. with linting speed, lock management, package dependency separation, correct python version mgmt and no need to fudge with venv.

Re: Python's pre-declared constants are kinda weird

#83
post #58

Python is awful. There are so many one offs in libraries, none agree on a style, it’s slow, and it’s way too easy to do the wrong thing. I often work with data scientists and have to productionize their jupyter notebooks which is pure suboptimal hell. I guess it must be a good easy learning curve for research/scratchpad

I'm fine with the language. I just hate that you can't do import numpy==1.5.4 and the code gets exactly the version it wants.

The imports/packages situation is terrible in general. This was basically broken until uv, and uv is still not the default.

And it's weird how you import files. They're dot-separated packages that resemble file structure but not exactly. NodeJS has a self-explanatory require("./foo.js") or "../foo.js". The newer JS `import` syntax is annoyingly different from `require` but not terrible.

Re: Python's pre-declared constants are kinda weird

#84

A lot of Python design decisions have felt weird and off to me but they’ve long justified it by saying that it’s those little ugly design choices that make the language so usable and effective in practice compared to more well-designed languages that hardly anybody uses. I’m not enough of an expert to clearly say if that’s really true, but imo, there’s a repeated pattern of slightly weirdly designed languages becomin…

JS is a lot less weird than Python. And Python is what I started with and continue to use half the time. The article missed the most common one, __name__ == "__main__" like wtf

I’m not a regular JS user and haven’t touched the language in a long time, but I remember a (popular?) website for teaching modern JavaScript mentioned that some aspect of the function/macro that returns the type of an object was just plain wrong in a specific and important case. This was years ago however, so maybe the problem isn’t there anymore. Anyhow, I added JS to the list mainly because it is known as a badly designed language and Brendan Eich seems to agree.

Re: Python's pre-declared constants are kinda weird

#85
> True, False, and None are keywords. they aren't identifiers, they're just straight up their own lexical tokens.

Could this be so that the interpreter don't inadvertently manipulate them or pass them to a function? param=None and param="" can be very different.

Re: Python's pre-declared constants are kinda weird

#86

Earlier quoted context omitted.

JS is a lot less weird than Python. And Python is what I started with and continue to use half the time. The article missed the most common one, __name__ == "__main__" like wtf

I’m not a regular JS user and haven’t touched the language in a long time, but I remember a (popular?) website for teaching modern JavaScript mentioned that some aspect of the function/macro that returns the type of an object was just plain wrong in a specific and important case. This was years ago however, so maybe the problem isn’t there anymore. Anyhow, I added JS to the list mainly because it is known as a badly…

There are certainly weird things about it, but they're all things you can ignore especially in modern times, whereas in Python you're constantly dealing with it head-on.

Re: Python's pre-declared constants are kinda weird

#87
Love the investigation and write up.

Took me down some rabbit holes, but interesting to see the chatter about the fix here:

https://github.com/python/cpython/issues/80233

Initially you could reassign True,False but that was verboten with the switch to python 3! The walrus operator was the one simply an oversight.

https://python-history.blogspot.com/2013/11/story-of-none-tr...

Explanation from Guido himself

Re: Python's pre-declared constants are kinda weird

#88

Earlier quoted context omitted.

Scripting languages are awful. Python is one of the nicest scripting languages.

Holy 2000s! Are we really still doing “programming” vs “scripting”?

Why wouldn't we? It's still a very relevant distinction, even if the terminology is a bit weird (since scripting is by definition programming). A programmer has very different needs when he writes a script to automate some server tasks versus a complex piece of software. It makes perfect sense that different tools will be more or less effective at meeting those different needs.

Re: Python's pre-declared constants are kinda weird

#89
post #58

Python is awful. There are so many one offs in libraries, none agree on a style, it’s slow, and it’s way too easy to do the wrong thing. I often work with data scientists and have to productionize their jupyter notebooks which is pure suboptimal hell. I guess it must be a good easy learning curve for research/scratchpad

I'm fine with the language. I just hate that you can't do import numpy==1.5.4 and the code gets exactly the version it wants.

Relatively new, scripts can define dependency metadata now adays to achieve that to some degree. Any pip style versioning including an exact match works there.

https://packaging.python.org/en/latest/specifications/inline...

Re: Python's pre-declared constants are kinda weird

#90
post #71

Earlier quoted context omitted.

I’ll never not be bitter than Python “won” the scripting language war over Ruby, more or less just because someone did a bit of AI work in it first and it took over that space by default. Ruby has such a nice holistic consistency to it. With a few exceptions, it feels like it was conceived of by one person with a core idea in mind. Python feels like a mess.

Python's strength is that it's easy to make C libs work in it. That's also why CPython is de facto the only Python implementation and stuff like PyPy never took off.

> Python's strength is that it's easy to make C libs work in it.

SWIG[0] makes working with C libraries trivial for over a dozen programming languages; Perl, Python, and Ruby included.

0 - https://www.swig.org/

Post reply on HN