How to write X in both Python 3 and JavaScript
31–40 of 84 posts
Re: How to write X in both Python 3 and JavaScript
#32javascript:
someList = [ 40, 2, 1, 3, 7, 99]
someList.sort()
Array(6) [ 1, 2, 3, 40, 7, 99 ]
python: someList = [ 40, 2, 1, 3, 7, 99]
sorted(someList)
[1, 2, 3, 7, 40, 99]Re: How to write X in both Python 3 and JavaScript
#33How to write using X in both languages: Python: https://github.com/python-xlib/python-xlib Node.js: https://github.com/sidorares/node-x11
Common Lisp: https://github.com/sharplispers/clx
Go: https://github.com/BurntSushi/xgb
Any others?
(Looking for implementations of the X11 protocol in $LANGUAGE, not bindings to the C Xlib)
Re: How to write X in both Python 3 and JavaScript
#34Creator here! Let me know if you have any suggestions.
Re: How to write X in both Python 3 and JavaScript
#35Creator here! Let me know if you have any suggestions.
Re: How to write X in both Python 3 and JavaScript
#36Re: How to write X in both Python 3 and JavaScript
#37Creator here! Let me know if you have any suggestions.
Re: How to write X in both Python 3 and JavaScript
#38Creator here! Let me know if you have any suggestions.
Re: How to write X in both Python 3 and JavaScript
#39A weird reference imo. Perhaps useful to build as a learning experience but I wouldn't expect who needs if/else included in a cheat sheet to be ready to learn to languages.
The value is in finding what is the most idiomatic way to do something in either language. For example if you're coming from Python and you're used to sum() it is useful to check this reference for the most idiomatic way to do it in JavaScript before doing it by hand with anonymous functions and reduce or looping through the list (as is the case unfortunately).
Re: How to write X in both Python 3 and JavaScript
#40As someone who is often switching languages, I find these sorts of cheatsheets useful. I know all the syntax in them but I'll be damned if I can ever remember which language uses which until I've settled back in to things.