News for hackers. Stuff that matters.
Re:PyPy.js: A fast, compliant Python implementation for the web by dag11 on Wednesday May 06, 2015 @03:39AM (#9497087)
Or this:

    import js
    js.globals.console.log('hi!')
Re:PyPy.js: A fast, compliant Python implementation for the web by catlover99 on Wednesday May 06, 2015 @04:16AM (#9497204)
I'm loving this, my head is reeling with the glint of possibilities

    import js
    js.globals.console.log('hi!'*5)
Re:PyPy.js: A fast, compliant Python implementation for the web by e12e on Wednesday May 06, 2015 @05:22AM (#9497413)
Seems to be some issues with the interop still, eg:

  import js
  >>> "globals" in dir(js)
  True
  >>> "console" in dir(js.globals)
  False
  >>> js
  <module 'js' (built-in)>
  >>> js.globals.console
  <js.Object handle=14>
So apparently introspection doesn't quite work with the wrapped js. Also, if you try: "[ i for i in js.globals]" (or equivalently iterate/loop over the globals-object) - the whole repl/tab hangs.

Not really an issue for running business logic in the browser, but if this was a full python repl-interface (with ipython support!) to the whole browser DOM -- that'd be a fantastic tool.

Re:PyPy.js: A fast, compliant Python implementation for the web by bzbarsky on Wednesday May 06, 2015 @02:16PM (#9500674)
The introspection bit is because js.globals is implemented with a fancy __getattr__ but doesn't have a __dir__. In general, dir() is not reliable in the face of custom __getattr__ implementations unless the implementor goes out of the way to make it work.
Re:PyPy.js: A fast, compliant Python implementation for the web by e12e on Thursday May 07, 2015 @01:58AM (#9503500)
Oh, right. I didn't consider that:

  Welcome to PyPy.js!
  >>> import js
  >>> "console" in js.globals
  True
  >>> "console" in dir(js.globals)
  False