Live data from Hacker News

Python 3.12

python.org

311–320 of 344 posts

Re: Python 3.12

#311
post #66
post #49

Earlier quoted context omitted.

Since it currently lacks any way to transfer objects between interpreters other than pickling, does it offer any advantage over the multiprocessing module?

Not for pure python code; but there's massive advantages for mixed C(++) and Python: I can now have multiple sub interpreters running concurrently and accessing the same shared state in a thread-safe C++ library. Previously this required rewriting the whole C++ library to support either pickling (multiplying the total memory consumption by the number of cores), or support allocating everything in shared memory (which…

> I can now have multiple sub interpreters running concurrently and accessing the same shared state in a thread-safe C++ library.

Can sub-interpreters be used to share a db/http/etc connection pool across multiple processes?

Re: Python 3.12

#312

Earlier quoted context omitted.

What does a modern Fortran bring that Julia does not? Small binaries?

Language stability, and easy C ABI for embedding into other programs. Julia isn't really a language for embedding afaik.

Sure, not in the traditional sense. Since it does not make small standalone libraries, even though possible, I would not make a native extension with it. But juliacall works fine for Python and R. Quite seamless.

Re: Python 3.12

#313
post #156

Earlier quoted context omitted.

So then we're making this about freedom as the central moral aspect. Then what about the freedom of the Python maintainers to post what they want? Why the selective defense?

False equivalency. The equivalent would be someone commenting saying they shouldn't publish release notes because of Reasons, and I would defend their right to publish release notes.

That's quite the reach. Morals are more general than that. This isn't high school debate club.

Re: Python 3.12

#314

Earlier quoted context omitted.

Yes. I’ve written explicit code that needed this 100s of times.

Yeah I've memorized it by now: for i in range(len(lst) // batch_size + 1): batch = lst[i * batch_size : (i + 1) * batch_size]

You have a minor bug -- when len(lst) is a multiple of batch_size, this will have an extra iteration at the end with an empty batch. The fixed version is `range((len(lst) + batch_size - 1) // batch_size)`, which emulates `ceil(len(lst) / batch_size)`. Yet more proof that this should be part of stdlib :)

Personally I think I'd actually write it like this:

    for i in range(0, len(lst), batch_size):
        batch = lst[i:i+batch_size]
The docs give another pretty nice implementation using iter() and islice() in a loop (but it uses the walrus operator `:=` so it requires Python 3.8+ as written).

Re: Python 3.12

#315
post #313

Earlier quoted context omitted.

False equivalency. The equivalent would be someone commenting saying they shouldn't publish release notes because of Reasons, and I would defend their right to publish release notes.

That's quite the reach. Morals are more general than that. This isn't high school debate club.

> That's quite the reach.

Unexplained claim about what's being reached for.

> Morals are more general than that.

Yes, obviously. How does this apply to what I said?

> This isn't high school debate club.

Okay?

Re: Python 3.12

#316
post #314

Earlier quoted context omitted.

Yeah I've memorized it by now: for i in range(len(lst) // batch_size + 1): batch = lst[i * batch_size : (i + 1) * batch_size]

You have a minor bug -- when len(lst) is a multiple of batch_size, this will have an extra iteration at the end with an empty batch. The fixed version is `range((len(lst) + batch_size - 1) // batch_size)`, which emulates `ceil(len(lst) / batch_size)`. Yet more proof that this should be part of stdlib :) Personally I think I'd actually write it like this: for i in range(0, len(lst), batch_size): batch = lst[i:i+batch_…

Blatant reason why a native solution was long overdue.

Re: Python 3.12

#317
post #149

Earlier quoted context omitted.

I'm holding out hope for a Fortran resurgence. It's a tiny hope. But a hope nonetheless. Fortran is fun.

I'm curious - what do you particularly like about Fortran that isn't otherwise broadly available? Is it a matter of cultural idioms, a unique composition of features, or something else entirely?

Modern Fortran (2008+) has built-in support for matrices, complex numbers, co-arrays (parallel programming), array slicing, etc. This makes it easy to write performant compiled code if you mostly deal with numerics.

Fortran has also added support for e.g. object-oriented programming, pure functions (no side effects for better optimization), and pointers. So idiomatic modern Fortran code looks very different from the “Fortran 77” code that many people might think of when they hear the name :).

Re: Python 3.12

#318
post #281

Oh hey, the useless (except for leetcode) language got an update. Yay, maybe more people try to write boring business logic without type safety. Can't wait.

1/ it’s literally the most used PL atm 2/ python is type safe, actually 3/ if you need python for leetcode you can’t really look down on anyone

1. WordPress was too for a time, despite being slow and choke-full of vulnerabilities.

2. Right, at run time. My great-grandma always did say "the best time to catch bugs is in production, use Python sonny".

3. It's not that I need it, it's just that I can't think of any other use for it. Hopefully big data and IoT catches on to the first two points soon enough.

Re: Python 3.12

#319

Oh hey, the useless (except for leetcode) language got an update. Yay, maybe more people try to write boring business logic without type safety. Can't wait.

I recently took part A of Dan Grossman's Programming Languages' course, and he focus on Standard ML which is strongly-typed. It was enlightening to learn about, and after completing Part A, I too felt that any language that lacks type safety can't be a serious language. I recently started using Python again for a side project, and I had forgotten how good of a dev experience Python offers. I wish I could explain bett…

I appreciate the thoughtful response, despite my comment being less then that. With that said, I am using Python in production for a line business app for a 2 billion dollar company now. I can't imagine why anyone would use this for a multi-team project outside of areas where it's the language with the most libraries(IoT, ML).

Not only is there the type safety issue, the standard testing and ORM libraries are way behind with .NET and Java have. Even Node seems better.

Re: Python 3.12

#320
post #313

Earlier quoted context omitted.

That's quite the reach. Morals are more general than that. This isn't high school debate club.

> That's quite the reach. Unexplained claim about what's being reached for. > Morals are more general than that. Yes, obviously. How does this apply to what I said? > This isn't high school debate club. Okay?

Your interpretation of "equivalency" is hard to understand in any context except one which seeks to limit the disagreement to an extremely narrow "debate" that just so happens to validate the ideology implied by your selective defense.

My response is to point out that your narrowing of the space of dicussion is not only noticed but acknowledged and explicitly challenged. In a conversation about morals this framing of yours is inappropriate and counterproductive. It is notable that you responded in the way you did, implying you're trying to keep this tactic subversive rather than explicitly acknowledging it. Classic move in rhetoric, to be sure.

You're acting like a smarmy high schooler who thinks they're good at reasoning because they're good at "debate".

Clear?

Post reply on HN