News for hackers. Stuff that matters.
Re:Python is Actually Portable by kristianp on Tuesday July 26, 2022 @09:06PM (#32245891)
What's python.com, and what does "python.com APE" mean? Is python.com an executable that runs on multiple OSs? Also why is the flask demo so slow?

I think some explanations might be helpful. I'm familiar with python, but not cosmopolitan libc.

Re:Python is Actually Portable by ahgamut on Tuesday July 26, 2022 @09:15PM (#32245943)
Cosmopolitan Libc allows you to build programs that run on six operating systems (Linux, Mac, Windows, FreeBSD, NetBSD, OpenBSD). I ported Python 2.7.18 and 3.6.14 to build on Cosmopolitan Libc because I wanted to have the same Python executable and my scripts with me everywhere :) I've updated the blog post for context.

The flask demo is unnaturally slow because my old computer is slow (running python tests in the background). plus I was using `_dummy_thread` Python3.6's pure-python threads implementation.

Re:Python is Actually Portable by kristianp on Tuesday July 26, 2022 @09:22PM (#32245998)
Thanks for the info, Cosmopolitan Libc looks like a cool project.
Re:Python is Actually Portable by ActorNightly on Wednesday July 27, 2022 @04:58AM (#32248300)
Yep, and author is a HN user

https://news.ycombinator.com/user?id=jart

Her comment history is full of good info about the project.

Re:Python is Actually Portable by jart on Wednesday July 27, 2022 @08:13AM (#32249513)
/me waves
Re:Python is Actually Portable by shakna on Tuesday July 26, 2022 @09:19PM (#32245976)
APE is for αcτµαlly pδrταblε εxεcµταblε [0], a kind of executable bundle that runs from the exact same file on Linux, MacOS, Windows, DOS, BSD, etc.

Cosmopolitan is a libc for that bundle [1], so that you can write your C code just the once, and then you have just the one output executable. No download-per-platform, or that's the goal.

[0] https://justine.lol/ape.html

[1] https://justine.lol/cosmopolitan/index.html

Re:Python is Actually Portable by phreack on Wednesday July 27, 2022 @12:54AM (#32246974)
It's a nitpick but I wish everyone stopped spelling it like that and call it Actually Portable Executable at least. That kind of spelling really messes up with my reading comprehension, and I think it does for many people.
Re:Python is Actually Portable by samatman on Wednesday July 27, 2022 @05:53AM (#32248573)
No inside knowledge here but I figured Justine intends it as a shibboleth.

I use a magic string somewhere, which has control codes, three ASCII digits for versioning, and an RTL UTF-8 character, and is exactly eight bytes wide.

Anything munges my file, I'll know. Meanwhile I can just mask it.

Re:Python is Actually Portable by ElectricalUnion on Wednesday July 27, 2022 @08:19AM (#32249564)
> No inside knowledge here but I figured Justine intends it as a shibboleth.

I would not call it a shibboleth, but vague, generic terms are known to be for most purposes unsearchable, and having a really unique string identifier for your thing could make it more valuable.

It reminds me of this other HN link:

https://news.ycombinator.com/item?id=32241020

Re:Python is Actually Portable by IshKebab on Wednesday July 27, 2022 @07:27AM (#32249190)
That's not really what a shibboleth is...
Re:Python is Actually Portable by samatman on Wednesday July 27, 2022 @09:34AM (#32250191)
Obviously we're from different tribes because clearly you're wrong, and I'm compelled to cut your throat and throw you in the Jordan river. I think. Been awhile since I've reviewed the source material.
Re:Python is Actually Portable by nano9 on Wednesday July 27, 2022 @10:59AM (#32251267)
It's a shibboleth for knowing who the author is, you could say.
Re:Python is Actually Portable by karatinversion on Wednesday July 27, 2022 @06:11AM (#32248657)
Surely we should transliterate it as “actmally pdrtable ekhecmtable”?
Re:Python is Actually Portable by shakna on Wednesday July 27, 2022 @03:40AM (#32247868)
My screen reader doesn't pronounce it the way you'd expect, because it's not using Greek characters the way they should be, but it is the name. Transliterating it, is as wrong as using the original, but the author prefers the original, so that one wins out.
Re:Python is Actually Portable by dEnigma on Wednesday July 27, 2022 @01:59AM (#32247315)
Terrible for screen readers too I'd assume. But maybe I'm underestimating their abilities.
Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @02:22AM (#32247431)
Screen readers can surely handle Greek just fine, the only problem with the given spelling is that it uses "lookalike" glyphs instead of corresponding characters from the Greek alphabet (eg. use of "mu"/µ for "u").

Of course, I am sure some screen readers will simply take a custom text preprocessor that will turn l337sp34k and similar spellings like this one into regular text, but I am certain none of them have it as the default.

Re:Python is Actually Portable by tasuki on Wednesday July 27, 2022 @03:11AM (#32247688)
Well, αcτµαlly pδrταblε εxεcµταblε is what the author calls it. I appreciate it when people respect author's choice of naming. If I had a wish, it would be for the author to change the name.
Re:Python is Actually Portable by pseudalopex on Wednesday July 27, 2022 @05:50AM (#32248558)
The author calls it Actually Portable Executable too.[1]

[1] https://justine.lol/ape.html

Re:Python is Actually Portable by nano9 on Wednesday July 27, 2022 @11:03AM (#32251316)
The Greek delta being used as a "o" irks me a bit too, because to me it looks very much like a consonant, but I make a one-off exception for this project.
Re:Python is Actually Portable by orthoxerox on Wednesday July 27, 2022 @06:19AM (#32248715)
Or Actmally pdrtable execmtable, at least.
Re:Python is Actually Portable by toyg on Wednesday July 27, 2022 @06:57AM (#32248949)
Probably bad for SEO too.
Re:Python is Actually Portable by toyg on Wednesday July 27, 2022 @08:59AM (#32249878)
SEO has become such a tainted word that clearly it cannot be used anymore to shorten "Making something useful easy to find in search engines by anyone who might be interested" - people think anything mentioning SEO is from narcissists or scam artists, and downvote.

What other term would people suggest then? Surely it's a real concern for projects to be easily accessible by people looking for them.

Re:Python is Actually Portable by truffdog on Tuesday July 26, 2022 @09:14PM (#32245940)
Re:Python is Actually Portable by nodja on Tuesday July 26, 2022 @09:19PM (#32245973)
APE stands for Actually Portable Executable, an executable file that can run on the major platforms unmodified (windows/linux/mac/etc.)
Re:Python is Actually Portable by TaylorAlexander on Wednesday July 27, 2022 @02:02AM (#32247329)
Yeah “python.com” is an atrocious name for a program. Like seriously wtf.
Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @02:27AM (#32247448)
Why would you say that?

DOS .COM programs were pure maching language programs with no OS-specifics like headers or syscalls (though running in real mode, they did expect BIOS interrupts), so that makes sense to me: they are trivially portable.

The most famous one was COMMAND.COM.

Re:Python is Actually Portable by TaylorAlexander on Wednesday July 27, 2022 @02:51AM (#32247581)
I say that because "python.com" looks like a URL. DOS was a loooong time ago (I used it in my youth) and well out of the memory of most internet users today. So instead they see "python.com" and think it's a web address. And while I thought it would direct you to a website about python, you know where that address goes? To a website that has something to do with creating your own camsite. Yeah... that kind of camsite.

And then, it's bad because a user trying to search for it using the universal search/URL bar in their browser can't just type that in and hit enter to search for it, they have to manually select that they want to search for it, or else they go to the site about starting your own camsite.

AND THEN... once they have googled for it... none of the results on the first page have anything to do with this program as far as I can tell.

So yeah, weird, obscure, confusing branding that makes the program hard to search for.

EDIT: I could be missing something? Does this program have a different name and python.com is solely the file name of the executable or whatever? It still seems like it could be more descriptively named.

Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @04:24AM (#32248100)
Yeah, I was aware most would take it as a domain name, but we _are_ on HackerNews, and I think .COM is still an applicable executable extension on Windows. As such, it strikes me as a decent name (when looked at independently).

But ouch, I haven't looked where python.com might be pointing to today, so that's indeed unfortunate.

As for search results, I think the most obvious candidate for bad naming is... the Go language. ;-)

Btw, this is part of the Cosmopolitan (referenced multiplatform libc implementation) monorepo, and only lives in the `third_party/python` directory. I am not sure if it's customary to name Cosmopolitan-linked binaries with a ".com" extension (perhaps it also alludes to the name "Cosmopolitan", but I guess then it'd be "cosm" or "cosmo"), but it definitely does not seem to be a public name you'd search for.

Searching for "python.com" (in quotes) on Kagi or Google returns a bunch of Python-related .com domains, whereas searching for "Actually Portable Python" returns the above site as the first hit — that's the name one should be looking under for this. Though I am sure it'd be nice if a more generic "multi-platform Python binary" also matched some of this (though platforms sometimes mean architectures as well).

Re:Python is Actually Portable by booi on Wednesday July 27, 2022 @04:49AM (#32248235)
I was confused by this naming scheme and I am an (allegedly) seasoned software engineer of the DOS era (team 6.11a).

Reading these comments about why it's named python.COM, yes that's pretty clever but it didn't even occur to me when I first read the post and I suspect the majority of people on hackernews had the same impression.

Go is definitely also bad naming, but the domain is golang.org and the canonical search term for the Go programming language is "golang".

In this day and age, we should probably be optimizing for clarity and searchability instead of "clever use of an outdated tech naming" which half of the engineers nowadays wouldn't even know about.

Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @07:37AM (#32249256)
Oh, this is just my guess why it's named .COM: I have no idea if any of it is true, and I am in no way related to the project!

I am not disagreeing on the clarity and naming, but in this case, I don't think it's a big deal at all.

Re:Python is Actually Portable by jart on Wednesday July 27, 2022 @08:38AM (#32249706)
It's named .com because it's a flat executable format. If you map it into memory and start executing at the first byte (MZ which means JG +69) then it'll just work.
Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @09:54AM (#32250413)
Thanks for confirming my guess! Nice work on getting the conpatibility layers for sys interfaces done as well!
Re:Python is Actually Portable by fragmede on Wednesday July 27, 2022 @02:46PM (#32254777)
Not that google is super case sensitive, but maybe it could be stylized as python.COM to emphasize the DOS roots.
Re:Python is Actually Portable by rusticpenn on Wednesday July 27, 2022 @04:01AM (#32247984)
I agree with you. I had the same sentiment while reading the site.
Re:Python is Actually Portable by adlpz on Wednesday July 27, 2022 @03:19AM (#32247730)
If you are looking for a multi platform build of a specific version of python built with an obscure libc for some niche use case it's _very_ likely none of that is an issue for you, at all.

This is a non issue.

Re:Python is Actually Portable by diffeomorphism on Wednesday July 27, 2022 @02:42AM (#32247533)
Because you are posting on news.ycombinator.com? It might have been a sensible name 30 years ago, but now?
Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @04:36AM (#32248165)
I would say .com extension as an indication of an executable is acceptable exactly because we are on HackerNews (and not W3Schools.com, for instance). Basically, IMHO, "hackers" are supposed to know a bit of (arcane) history as well: "hacking", to me, presumes a deeper investment in the field. Otherwise, they might only be (web) software developers (or engineers).

But to each their own.

(I think the most unfortunate thing is what content is present on the python.com domain, as a sibling comment highlighted)

Re:Python is Actually Portable by jart on Wednesday July 27, 2022 @08:42AM (#32249743)
It's nothing that hasn't happened in Blade Runner. Watch her take the pleasure from the serpent that once corrupted man.
Re:Python is Actually Portable by mike_hock on Wednesday July 27, 2022 @05:22AM (#32248444)
But it's precisely not that, it's a polyglot.

And how is headerless raw assembly that expects the bios interrupts to be usable "trivially portable"? If it was, it would run on modern amd64 OSs without emulation, but it doesn't.

Re:Python is Actually Portable by necovek on Wednesday July 27, 2022 @07:43AM (#32249297)
COM "format" is "trivially" portable for a limited subset of functionality where you don't interface with the rest of the system except possibly memory (I think .o files produced by GCC compiler are very close to pure machine instructions too, before they get massaged into an ELF file with ld): in the sense that you can wrap them in a function and just execute them on the same architecture.

The fact that system interfaces like BIOS interrupts may or may not work is insignificant when you start thinking of it as only a playful name.

And let me repeat a word of warning: this is only my guess, I am unrelated to the project.

Re:Python is Actually Portable by samatman on Wednesday July 27, 2022 @05:57AM (#32248590)
python.exe is the only other option to fulfill the Actually Portable requirement on Windows.

Thing is, an APE is a COM file, not an EXE. Different headers, which contemporary Windows no longer cares about; but why lie about it? python.com is in COM format, as far as Windows is concerned.

Added for clarity: 'no longer cares about' meaning, Windows loads executables by checking the header for COM or EXE format and behaving accordingly, it's which of the two valid extensions gets used which it no longer cares about.

Re:Python is Actually Portable by jart on Wednesday July 27, 2022 @09:06AM (#32249943)
Just to clarify, APE is both an EXE and a COM file. The COM file format is basically just flat executable code. The only thing you need to do, to be a legal .com file, is if the program is loaded and execution starts from the first byte -- it works. APE meets that requirement for Linux and bare metal. It uses a polyglot to tell if the processor is running in real mode or long mode within its DOS stub. https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1... APE is also a legal EXE file because it has the MZ header. However... I thought it'd be more cool to signal as a DOS binary than to signal as a Windows binary, since signalling as the latter would probably be a turnoff for the Mac/Linux/BSD crowds, who are also supported by APE.
Re:Python is Actually Portable by TaylorAlexander on Wednesday July 27, 2022 @12:36PM (#32252698)
The base name of the file must be “python” and nothing else? This is where I thought more description could be used.