Creator here! Let me know if you have any suggestions.
Add Python 2 and or another language that has a static type system like C.
How to write X in both Python 3 and JavaScript
21–30 of 84 posts
Re: How to write X in both Python 3 and JavaScript
#22How to write using X in both languages: Python: https://github.com/python-xlib/python-xlib Node.js: https://github.com/sidorares/node-x11
Re: How to write X in both Python 3 and JavaScript
#23How to write using X in both languages: Python: https://github.com/python-xlib/python-xlib Node.js: https://github.com/sidorares/node-x11
Re: How to write X in both Python 3 and JavaScript
#24Creator here! Let me know if you have any suggestions.
Nice list. Perhabs just personal preference but I'd use for(let element of someList){ console.log(element); } instead of someList.forEach(element => { console.log(element) }) for...of is easier to read and recognize as a loop construct at first glance, and as far as I recall it's also faster nowadays since the body of the loop is inline, whereas forEach requires the runtime to deal with a function object.
Re: How to write X in both Python 3 and JavaScript
#25Re: How to write X in both Python 3 and JavaScript
#26Excellent educational tool - will be passing this around to colleagues who need it. Thanks!
Re: How to write X in both Python 3 and JavaScript
#27Re: How to write X in both Python 3 and JavaScript
#28Re: How to write X in both Python 3 and JavaScript
#29Creator here! Let me know if you have any suggestions.
Nice list. Perhabs just personal preference but I'd use for(let element of someList){ console.log(element); } instead of someList.forEach(element => { console.log(element) }) for...of is easier to read and recognize as a loop construct at first glance, and as far as I recall it's also faster nowadays since the body of the loop is inline, whereas forEach requires the runtime to deal with a function object.
Re: How to write X in both Python 3 and JavaScript
#30Earlier quoted context omitted.
Nice list. Perhabs just personal preference but I'd use for(let element of someList){ console.log(element); } instead of someList.forEach(element => { console.log(element) }) for...of is easier to read and recognize as a loop construct at first glance, and as far as I recall it's also faster nowadays since the body of the loop is inline, whereas forEach requires the runtime to deal with a function object.
Makes me wonder if maybe the syntax for mapping, folding and other collection operations should have a similar syntax to for instead of the current method-style syntax popular in most modern languages.
Example:
var queryLondonCustomers = from cust in customers
where cust.City == "London"
select cust;
I'm not a big fan of it honestly, the function style seems more consistent and easier to read to me.