logoalt Hacker News

ethersteedstoday at 5:28 AM3 repliesview on HN

But that's the trouble, Python has the slogan about only one way, but it's really not true in practice. Or maybe there's the one way that "should" be done, and then the half dozen other ways you'll encounter in the wild, as gp alluded.


Replies

mrigheletoday at 9:56 AM

the slogan came out when the alternative was Perl, and in Perl you could do the same thing in a million ways, and each of them was equally "idiomatic".

> There should be one-- and preferably only one --obvious way to do it. [1]

Note the `should` and the `obvious`. Is it not a strict rule about having a single way to do things. It is about the aspiration that, if you do something, there is single obvious way to do it, much better than the others.

(I agree though that not even this is true anymore, see how many different ways you have to interpolate strings).

[1] https://en.wikipedia.org/wiki/Zen_of_Python

KptMarchewatoday at 9:00 AM

Python is the language where in practice this is most untrue - maybe outside C++.

As an example, there are dicts, tuples, classes, NamedTuples, dataclasses, attr.s, Pydantic, and pretty much all of those solve similar problem (hold my data) but have slightly different properties and use cases.

otherme123today at 5:51 AM

Aren't LLMs a way to somehow extract the one way it should be done (or to be more precise, the more common way), over the half other ways? That correct way might be more difficult to extract from another languages that encourage multiple valid ways.

Also, if you trust the benchmarks, it seems that Python is, at the very least, decent enough for LLMs. There seems to be "no trouble" in practice, unless you show us better proof than "I feel like it must be bad for this and that".