Live data from Hacker News

Python's pre-declared constants are kinda weird

sebsite.pw

221–230 of 234 posts

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

#221

Earlier quoted context omitted.

I guess what I’m trying to do is draw a distinction between “improvement” and “change”. We can agree to disagree but my view is the things I called anti-features are not improvements at all, but rather loaded footguns. Python would be more coherent language without async/unenforced type hints/non exhaustive pattern matching. Like you say, it’s constrained by its history and I feel a lot of the recent changes are to m…

Type hints are very helpful on big projects. And are enforced by other tools. Honestly, this kind of criticism shows a lack of experience, and denial of reality for an almost 40 year old language. It sounds like scoffing at a Silver medalist to me. In fact, Python is better at what it does than almost anything from the era. That’s why we use it. Nothing is ever going to be perfect because better solutions are emergen…

> Honestly, this kind of criticism shows a lack of experience, and denial of reality for an almost 40 year old language.

Okay that's where you lost me. You can talk about the language from your perspective, and like I said we can agree to disagree, but it crosses a line when you want to comment on others' experience and put them down just because they disagree with you. No on is scoffing here, what I wrote was a considered criticism. Have a nice day.

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

#222

Earlier quoted context omitted.

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.

There is no reason why automating a server task cannot be a complex piece of software. I think you’re not aware of just what server automation is used for nowadays in countless cases. Also, Python is more popularly used in ML and web-development areas compared to server automation, so that would mean it’s not a scripting language by your logic.

There’s still a great difference in requirements between small and large scale development.

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

#223

Earlier quoted context omitted.

Type hints are very helpful on big projects. And are enforced by other tools. Honestly, this kind of criticism shows a lack of experience, and denial of reality for an almost 40 year old language. It sounds like scoffing at a Silver medalist to me. In fact, Python is better at what it does than almost anything from the era. That’s why we use it. Nothing is ever going to be perfect because better solutions are emergen…

> Honestly, this kind of criticism shows a lack of experience, and denial of reality for an almost 40 year old language. Okay that's where you lost me. You can talk about the language from your perspective, and like I said we can agree to disagree, but it crosses a line when you want to comment on others' experience and put them down just because they disagree with you. No on is scoffing here, what I wrote was a cons…

It’s about as near a well-documented fact as there is in this industry, and not intended to be an insult. Sometimes we need a wake-up call, and yes they’re not usually enjoyable. I know as well as anyone else, having received my share over the years.

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

#224

Earlier quoted context omitted.

What you put as an example isn't a footgun if you know how the language evaluation rules work. Once you understand that the "footgun" explains a dozen behaviors, which may be a weird behavior but it is consistent.

A property of footguns is they make sense and are coherent to people who do understand them. To them they are just useful tools (i.e. guns). A gun becomes a footgun when you put it in the hands of someone who doesn’t understand how it works and they promptly blow off their foot.

True in theory, in practice the quirks of Python can be understood in two days. As a user of both Javascript and Python for 20 years the Javascript quirks have no internal consistent logic that can be easily absorbed.

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

#225

Earlier quoted context omitted.

I don't understand how people talk about how Python is "easy to learn for beginners" or "easy to understand." To me it's so hard to remember and follow all the weirdness. Racket / Scheme / I dare say even Haskell would just be so much simpler for learners. I'm with Conal Elliot when he said on Type Theory for All that it is sooo much harder to understand a program in Python.

It would help a lot if every single racket/scheme example wasn't entirely made of single character variables.

There is a reason for that.

Consider appending two strings in Scheme:

    (string-append s1 s2)
Appending two strings in Scheme:

    (vector-append v1 v2)
Since the type is present in the function name, it would be redundant to include it in the variable name.

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

#226
post #181

Earlier quoted context omitted.

Again, this is a CS/Math major kind of thinking. The term __main__ means nothing syntactically. If we care about language acquisition -- thus language adoption -- it is always better to make "very common terms" in the language understandable to someone who is completely illiterate to your formal language. I honestly think one of the main reasons why python is so successful is as simple as: print "Hello world!" ...and…

Idk what's better, console.log or print, cause way back as a beginner I was confused what it means to print something. Like with ink? They're both ok, unlike the C++ or Java ways. But Python breaking hello world in version 3 was crazy.

Again, I would argue “very common commands” like printing text should be so unbelievably intuitive that beginners can use them even before learning what a “console” is, why there are “logs” and how dot notation works.

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

#227
post #56

Earlier quoted context omitted.

I've never become a fan of the language syntax, but otherwise I've become quite smitten with the total Python ecosystem. The Agents/LLMs + uv combo have made Python so useful and productive for me. My CLI tools publish from Github to PyPI so that I can run tools with just `uvx sql-agent-cli` or `uvx dlna-here. Nothing for me to handle downloading (directly myself), no environment to manually setup, portable (Linux, W…

> No more shell scripts, or TS/JS/PHP backend services You didn't use Perl before? https://xkcd.com/353/

That is a great xkcd comic! Sums up my feelings well. I honestly can't stand writing Python by hand (whitespace as syntax??) but here I am flying!

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

#228

Earlier quoted context omitted.

> There are reasons all those Py libraries with C code didn't just do it in SWIG. And those reasons are?

The point of SWIG is it works across many langs, but this comes at a cost. The SWIG .i and autogen'd C wrapper are extra layers that can get annoying, particularly during debug. Always hated dealing with SWIG'd libs at work. And Python C modules give easier control over Python specifics.

There's no doubt that hand-written language adapter libraries are less noisy than those generated by a tool such as SWIG. The thing is, debugging tool-generated adapter code is typically more category-based than individual use-case based.

IMHO, both approaches have merit depending on the situation. I lean towards using SWIG until and unless the situation warrants a hand-written solution due to the boilerplate nature of these types of libraries.

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

#229

Earlier quoted context omitted.

It would help a lot if every single racket/scheme example wasn't entirely made of single character variables.

There is a reason for that. Consider appending two strings in Scheme: (string-append s1 s2) Appending two strings in Scheme: (vector-append v1 v2) Since the type is present in the function name, it would be redundant to include it in the variable name.

This is literally my point. A python example would be like, calling readline to store someone's name into a name variable then printing a string that said "Hello name". Scheme examples are some abstract list manipulations.

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

#230

Earlier quoted context omitted.

There is no reason why automating a server task cannot be a complex piece of software. I think you’re not aware of just what server automation is used for nowadays in countless cases. Also, Python is more popularly used in ML and web-development areas compared to server automation, so that would mean it’s not a scripting language by your logic.

There’s still a great difference in requirements between small and large scale development.

[deleted]
Post reply on HN