Anyprint: use any language's print statements in Python
41–50 of 76 posts
Re: Anyprint: use any language's print statements in Python
#42Earlier quoted context omitted.
Perhaps you'd enjoy Nim which supports both. echo "hello world" echo("hello world") and as a bonus, also the following: "hello world".echo
I'm a primarily Python dev, have been for a long time. Lately I've been working in Javascript/typescript and there is no worse antifeature than having 3 different ways of doing the same thing. You try to figure out how to do something, you see 3 different solutions and you ask yourself, what's the difference? What's more correct? Will I need one over the other? Are they compatible? Is one way better supported than th…
Ironically, this is touted as a strength of Powershell. Speaking of which, this code supports none of Powershell's Write-Host variants.
Re: Anyprint: use any language's print statements in Python
#43Why stop at print statements? After all if you find yourself successfully using the print statement from some other language, you might accidentally also use its if, for loop, file handling and class declaration constructs among many others. Who's looking out for those people? This is just the beginning!
Re: Anyprint: use any language's print statements in Python
#44Ironically, it doesn't (and can't) support Python 2 print statements.
Re: Anyprint: use any language's print statements in Python
#45Earlier quoted context omitted.
Perhaps you'd enjoy Nim which supports both. echo "hello world" echo("hello world") and as a bonus, also the following: "hello world".echo
I'm a primarily Python dev, have been for a long time. Lately I've been working in Javascript/typescript and there is no worse antifeature than having 3 different ways of doing the same thing. You try to figure out how to do something, you see 3 different solutions and you ask yourself, what's the difference? What's more correct? Will I need one over the other? Are they compatible? Is one way better supported than th…
Re: Anyprint: use any language's print statements in Python
#46Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....
print chevron in python2 is super awesome print 'hello' f = open(file, 'w') print>>f, 'world' It just feels more "powerful" than Py3k's print(somestring, file=someopenfile)
But less obvious and readable, which is anti pythonic. If you want "power" over readability, there is ruby/perl.
Re: Anyprint: use any language's print statements in Python
#47Why stop at print statements? After all if you find yourself successfully using the print statement from some other language, you might accidentally also use its if, for loop, file handling and class declaration constructs among many others. Who's looking out for those people? This is just the beginning!
Coming from Powershell, nobody told me JavaScript copies arrays by reference instead of by value. Why would anyone want to pass a reference?
Re: Anyprint: use any language's print statements in Python
#48Earlier quoted context omitted.
Perhaps you'd enjoy Nim which supports both. echo "hello world" echo("hello world") and as a bonus, also the following: "hello world".echo
>"hello world".echo Okay I have to admit I love this one.
Also found in D.
And, frustratingly, did not get past the C++ committee.
Re: Anyprint: use any language's print statements in Python
#49Re: Anyprint: use any language's print statements in Python
#50Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....
print chevron in python2 is super awesome print 'hello' f = open(file, 'w') print>>f, 'world' It just feels more "powerful" than Py3k's print(somestring, file=someopenfile)
Print chevron is super awful, it's unreadable, hard to remember and difficult to search for.
The print function was a welcome improvement: it's not a statement (so can be used in a lambda, no need to fall back to sys.stdout.write), it doesn't use weird-ass syntax to redirect or suppress the final newline and it's more extensible (e.g. "end" or "flush" kwargs would have been… challenging to add to the keyword version)