News for hackers. Stuff that matters.
Re:How Many Lines of C It Takes to Execute a and B in Python? by vitiral on Monday December 11, 2023 @08:12AM (#38600337)
It seems like it doesn't answer it's own question, so I'll pose another.

The entire Lua core is 15kLoC. Is that more than or less than what's needed for python's "a + b", assuming a and b are defined.

I'm genuinely curious.

Re:How Many Lines of C It Takes to Execute a and B in Python? by kevindamm on Monday December 11, 2023 @10:33AM (#38601481)
Yes, it's a very tootsie-roll-center kind of answer, but it's clearly more than a few.

To answer your question, 15kLoC is more than enough to implement dynamic dispatch and the PyObject base struct, along with the special method logic for __add__ on any python object type.. but still a lot less than what's needed for all the special method types and a lot of boilerplate for the C-compatible interface around those methods.

Re:How Many Lines of C It Takes to Execute a and B in Python? by demondemidi on Monday December 11, 2023 @01:59PM (#38603917)
I wonder what percent of this audience got the tootsie-roll reference. Does anyone under 40 know it?
Re:How Many Lines of C It Takes to Execute a and B in Python? by steveklabnik on Monday December 11, 2023 @03:57PM (#38605410)
I am about to turn 38 and I got it, so it's at least slightly lower than 40.
Re:How Many Lines of C It Takes to Execute a and B in Python? by vitiral on Monday December 11, 2023 @06:48PM (#38607105)
Hey Steve, loved your work on Rust and your goodbye letter. Nice to see you in my comment chain
Re:How Many Lines of C It Takes to Execute a and B in Python? by steveklabnik on Monday December 11, 2023 @06:50PM (#38607125)
Thanks!
Re:How Many Lines of C It Takes to Execute a and B in Python? by depletedgherkin on Monday December 11, 2023 @08:19PM (#38607945)
I'm in Gen Z and I think I got it. The Tootsie pop commercial with the owl used to play all the time on Canadian TV.
Re:How Many Lines of C It Takes to Execute a and B in Python? by kevindamm on Wednesday December 13, 2023 @11:58AM (#38630225)
Onne... Two-hooo!