5 ms·
To the downvoters, you're wrong! Python3 is a distinct language. This is all you need to know: Python3 broke "Hello, World!" It doesn't get any more fundament
by PhantomGremlin 7y ago
To the downvoters, you're wrong! Python3 is a distinct language.
This is all you need to know: Python3 broke "Hello, World!"
It doesn't get any more fundamental than that.
- cwyers 7y agoThere are nontrivial programs that run on both Python 2 and Python 3.
- PhantomGremlin 7y agoTo quote from chapter 1 of K&R C: "The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages:" Print the words hello, world The program to do that is literally the very first program shown in the very first chapter of K&R C. 99% of Python programs before Python3 was announced used the print statement. Python3 broke 99% of existing programs. And your rebuttal is there are---now---nontrivial programs that run in both languages? How many of those nontrivial programs existed before python3 was announced? Zero. Zero programs like that existed. This historical revisionism astonishes me. Just because it is now, after the fact possible to write programs that behave the same in both Python2 and Python3 doesn't mean that they are the same language.
- takeda 7y agoHehe funny that you mentioned K&R, because hello world in original C no longer compiles in current compilers.
- PhantomGremlin 7y agoWorks for me. But maybe OpenBSD 6.2 isn't "current" enough for you? $ cat hello.c main() { printf("hello, world\n"); } $ cc hello.c hello.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main() ^ hello.c:3:2: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration] printf("hello, world\n"); ^ hello.c:3:2: note: include the header <stdio.h> or explicitly provide a declaration for 'printf' 2 warnings generated. $ ./a.out hello, world $ uname -a OpenBSD foo.example.com 6.2 GENERIC.MP#0 amd64 I think this illustrates my point. OpenBSD did what was necessary to keep the vintage 1978 hello.c program working on a recent system. If only Guido and his colleagues did the same.
- loeg 7y agoNot criticizing OpenBSD, but this has nothing to do with OpenBSD in particular (which uses Clang now). Grandparent 'takeda is just flat wrong. hello.c compiles and runs with extremely modern Clang and GCC versions (8.0.1 RC and 9.2.0, respectively). The former is a development RC and the GCC was released August 2019. And we can expect this going forward! The C standard is extremely stable and loathe to deprecate anything. gets(3) is finally gone in C11 and it has been deprecated since the 1999 standard. That's the only ABI removal in C history. There is absolutely no reason to expect that tiny program which doesn't invoke gets(3) to ever stop being compilable by standards-conforming C compilers.
- takeda 7y agoNo it didn't print("Hello World") Works on both
- loeg 7y agoPoC||GFTO regularly publishes its missives in polyglot files that are valid in multiple languages/interpretations; that doesn't mean those things are the same. E.g., a zip isn't a PDF, except sometimes with PoC||GTFO, it is. Here's another example of a program that runs in Bash, C, C++, Obj-C, Obj-C++, Perl, PHP, and Ruby: https://codegolf.stackexchange.com/a/7280/4545 https://codegolf.stackexchange.com/a/7280/4545 Python 2+3 is less extreme, but still: those nontrivial programs that run in both environment are just polyglot programs that happen to run in two different scripting languages. Given the experience with Python 2->3, is there any reason to trust the PSF not to make a similar mess with a 3->4 transition? That's my concern porting any Python2 code to 3. Are Python.org done making huge API breaks, or will they do it again?