6 ms·
Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....
by bugshideout 9y ago
Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....
- fdej 9y agoSame here. I will probably keep using Python 2 for as long as it works... simply because I don't have to type those parentheses.
- sooheon 9y agoAs someone most at home in lisps--there's just no accounting for taste ;)
- andybak 9y agoIs there a LISP with significant white space in place of parentheses? Our two groups could be united by the disgust of the rest of the programming community.
- emidln 9y agoCheck out Dylan and Sweet Expressions.
- acchan 9y agoThe Arc language wiki has this list of languages that make use of significant whitespace. https://sites.google.com/site/arclanguagewiki/more/list-of-languages-with-s-expression-sugar https://sites.google.com/site/arclanguagewiki/more/list-of-l...
- klibertp 9y agoSee this: http://readable.sourceforge.net/ http://readable.sourceforge.net/ Works with both Scheme and Common Lisp, two most popular Lisps out there. Nobody uses it because paredit/parinfer is just too convenient, but the option is there.
- mixmastamyk 9y agoHere's a nickel kid, buy yourself a decent editor. ;) Mine has snippets: pr<TAB> ---> print('%cursor%', %cursor%)
- dom96 9y agoPerhaps you'd enjoy Nim which supports both. echo "hello world" echo("hello world") and as a bonus, also the following: "hello world".echo
- FRex 9y agoLua does too, for literal tables and strings being sole argument you can omit parentheses. But to call method on a literal you need to add them. > print("OK") > print "OK" > ("OK %d"):format(1) I've seen some funky (ab)use of these, people using literal strings and tables and functions named class and similar to do: > class "Something" { > -- ... > }
- jmaa 9y agoThis is one of the reasons I love Lua. I'm constantly pleasantly surprised by Lua. It defines a few simple primitives, and allows you to do whatever you want with them, even to the absurd. Hell, it even allows you to do this: > somefunc "1string" "2string" "3string" > somefunc {} {} {}
- scrollaway 9y agoI'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 the other? The amount of time I've spent looking up differences between two APIs or two paradigms in Typescript is seriously ridiculous. And it feels really bad to not recognize something you've done before because it's written differently. Common culprits: require() and imports, the countless ways of creating classes, the crazy amount of different ways to implement similar or identical workflows in webpack and pretty much the entire JS ecosystem in general.
- indigo0086 9y agoAs a primary js developer (about 10 years) who in the most recent two years has done more and more es6 work I will revel in the day I don't have to use it in my day to day. I toy with clojure in my free time and even python and just hate the way the JavaScript language has been taken over not just by trends but with what I think are poorly thought out syntax additions. JavaScript seems like a language that has no opinion on the best way to do a thing, no well thought out constructs to eliminate boilerplate, and just sits there and waits for a Bower, and mom, a lodash, or a Babel to come along and tell it hoe to be a proper language.
- thehardsphere 9y agoWhen I saw the title I thought to myself "this is going to be some elaborate troll about Python2 vs 3's print, isn't it?"
- est 9y agoprint 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)
- nhumrich 9y ago> More powerful But less obvious and readable, which is anti pythonic. If you want "power" over readability, there is ruby/perl.
- masklinn 9y ago> print chevron in python2 is super awesome 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)
- RodericDay 9y agoIf you want power you can fprint = lambda string: print(string, file=somefile) and use fprint all over the place that little chevron trick is bad imo
- majewsky 9y agoYou'd like Perl: open my $file, '>', 'hello'; print{$file} "Hello";
- rnhmjoj 9y agohttps://www.youtube.com/watch?v=anP1TU1vHbs&t=11m50s https://www.youtube.com/watch?v=anP1TU1vHbs&t=11m50s
- masklinn 9y ago> for a language proud of getting rid of parenthesis Er… what? Python doesn't have braces, it has plenty of parenthesis. In fact, Python 3 added more since it upgraded several keywords to functions (not just print but also exec, and some forms of re-raising)
- Veedrac 9y agoLittle known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version. That this is so little known is why we have a complicated future.exec_, which is entirely needless! (https://stackoverflow.com/a/26098101/1763356 https://stackoverflow.com/a/26098101/1763356)
- masklinn 9y ago> Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version. That's not really true, although the syntactic compatibility does make for conveniently trivial cross-compatible code, Python 3 did not "remove the old, braceless version" it converted exec from a keyword (which could accept a single tuple parameter) to a builtin function (which takes up to 3 parameters). Which had the side-effect of requiring parenthesis. Incidentally, the print-tuple-trick is cute, I hadn't considered it.
- Veedrac 9y agoYes, I explained badly. I appreciate the clarification.