Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • I made a constant library for python which I liked some years ago. I wonder if any of my ideas made it in:

    https://github.com/nucypher/constantSorrow/blob/master/tests...

  • Isn't "..." then also behaving like True, False and None, i.e. being a lexical token that rewolves to a hardwired value during parsing?
    by xg15
  • If you count pre-release versions, there are actually 7 pre-declared constants, since Python 3.15 (planned for release in November [0]) adds a new constant "TYPE_CHECKING" that should behave like "Ellipsis" and "NotImplemented" do right now [1].

    [0]: https://peps.python.org/pep-0790/#schedule

    [1]: https://peps.python.org/pep-0781/#backwards-compatibility

  • 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.

  • I remember reading that in early versions of Python there was no built in True and False. Each user would implement this themselves as

    True = 1

    False = 0

    then later these got added to the language. In Python 2 you could still reassign and swap them so that 'if False' was actually true!

    True, False = False, True

    Python 3 you could no longer reassign them.

  • The __debug__ constant is really weird - any block of code guarded with `if __debug__:` will be entirely omitted from the bytecode under PYTHONOPTIMIZE=1. This and `assert` are the only two examples of real “conditional compilation” in Python. This is also the reason why you cannot assign to __debug__: doing so would make it possible to invalidate the compiler’s assumption about `if __debug__:` statements.
  • Past: https://news.ycombinator.com/item?id=49284392 (with my comment), https://news.ycombinator.com/item?id=49250370 .

    Nice to see it get attention this time.

  • 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 becoming super popular: Python, Javascript, perhaps C as well. Or, maybe we only notice the weirdness because these languages are used so much and get nitpicked to no end.

Explore Birbla archives