Arcane Python functions

10 views
Skip to first unread message

Jethomas5

unread,
Apr 18, 2015, 7:07:23 AM4/18/15
to glowscri...@googlegroups.com
When I try to use "sort", "sorted", "set" VPython tells me there is no such thing.

Is there an easy way I can load Python functions like these?

Bruce Sherwood

unread,
Apr 18, 2015, 1:20:50 PM4/18/15
to glowscri...@googlegroups.com
VPython in a browser, with good performance, is possible thanks to the RapydScript Python-to-JavaScript compiler. Because the universe of Python functions and libraries is gigantic, RapydScript does not attempt to implement all of that. However, RapydScript is pretty transparent to using all of JavaScript's extensive facilities. If you do searches such as "JavaScript sort" or "JavaScript set" you may well find what you're looking for.

I've found http://www.w3schools.com/js/ to be quite useful for getting an introduction to and an overview of JavaScript facilities.

I'll comment that JavaScript was originally aimed just at making web pages dynamic, and it was used mostly by web designers. However, in the last few years there has been an explosion of uses, including computational uses, with more and more libraries being created to do fancy things. For example, a colleague named Cody Smith showed me a physics engine that does something remarkable:

http://www.glowscript.org/#/user/Bruce_Sherwood/folder/Pub/program/oimo-falling-spheres
Reply all
Reply to author
Forward
0 new messages