Probably because of the ecosystem. And that will be when everyone transitions to Py3, when stuff they want to use is Py3 only.
Probably because of the ecosystem. And that will be when everyone transitions to Py3, when stuff they want to use is Py3 only.
This always bugged me about Python:
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
You know god damn well what I mean Python, so just do it instead of nitpicking me. Python 3 doesn't fix this, and makes it worse. Case in point (using a web repl as I'm not at a computer with Py3 on it at the moment): >>> range 4
Traceback (most recent call last):
File "python", line 1
range 4
^
SyntaxError: unexpected EOF while parsing
Okay, reasonable enough... >>> print 4
Traceback (most recent call last):
File "python", line 1
print 4
^
SyntaxError: Missing parentheses in call to 'print'
You know god damn well what I mean, Python. You know what you could have done to have your precious sys.stdout.write(repr(arg) + "\n"[, extras]) as a smaller replaceable built-in function that wouldn't break everyone and make them sad? Called it Echo. Puts. Print3. Println. Nope, just breaking the most basic things, for no real good reason since it's not like Python is going the Lisp route of killing the distinction between statement/expression in favor of everything being an expression. //rantSorry I hit a nerve. You insisted it 'wasn't the same' but didn't give an example.
If you don't need what Py2 provides, I don't know why it wouldn't be 'good enough'. And since I built a lot of complex stuff in Py1, I can't imagine why anyone would think it is not good enough for building complex stuff.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
> You know god damn well what I mean Python, so just do it instead of nitpicking mePython has no idea that's what you mean.
>>> repr(exit)
'Use exit() or Ctrl-D (i.e. EOF) to exit'
It's just the exit function has a __repr__ that returns that. Why the hell would Python make just 'exit' exit the interpreter? That's unlike anything else in the language. >>> print 4
SyntaxError: Missing parentheses in call to 'print'
This is a special case to help with the transition from 'print' to 'print()'. Should 'i 1' have a message saying a parenthesis is missing? I could mean 'i + 1', or 'i, 1'.1. I got used to it, fairly quickly. That made me care less.
2. I used print-statement debugging less, and unit tests more. This was a good thing generally.
3. For those times when I did need print to debug, I found I could drop in pprint:
import pprint
print = pprint.pprint
which is very useful. That won me over.I've rarely needed naked print to do anything but quick testing and debugging (because by the time I have a command line script, I want at least to have a -q option, so I need to run output through some kind of proxy function). The standard arguments for print() (i.e. composability, extra arguments), I've not needed, but the ability to replace it, I rely on totally now.
Of course, YMMV, this is just my experience.
Meanwhile...
#include<stdio.h>
int main(void) {
printf "Hello World\n";
return 0;
}
hello.c:4:9: error: expected ';' after expression
printf "Hello World\n";
^
;
hello.c:4:3: warning: expression result unused [-Wunused-value]
printf "Hello World\n";
^~~~~~
hello.c:4:10: warning: expression result unused [-Wunused-value]
printf "Hello World\n";
^~~~~~~~~~~~~~~
2 warnings and 1 error generated.
You know god damn well what I mean, C, so just do it instead of nitpicking me!print isn't a statement in python 3 and range was never a statement