On 18 February 2018 at 20:25, Igor Machado <
igor.m...@gmail.com> wrote:
> Thanks for the reply. Do you think there could be another way to do it? For
> example, I tried a lot to deal with emscripten and somehow from python 3.4
> onwards, things got really complicated...
> I am part of a big project that envolves using python to convert itself to
> another byte code language. We have funding to give in this direction and if
> things worked out with Brython that would be a very nice project to support.
>
> I really got to this point where array and opcode were needed (in fact
> "array" was not needed for our functions, somehow I made without it), so
> question is: is it possible to port opcode? Or i am looking at a illogical
> and impossible task? :-)
Porting opcode is as close to "ilogical and impossible task" as it
can be, in the case of
Brython. Saying in other words what Kiko wrote: Brython does not use
opcodes at all -
Python opcodes or otherwise. So, while it would be possible to "port"
a module to deal
with Python opcodes (it is likely Pypy should have a Python version of
it) , it would not be able to
work with Brython code itself. (You could have, however,a brython
program operating on
Python code uploaded to it somehow - but that is less useful than
simply having a plain
Python CLI or GUI program). So,if you can a Brython class never have
a "code object" for its body,
(even if the attribute may be implementeed for compatibility purposes)
- it is instead tranformed
into a Javascript object that have the (transpiled) methods it would have.
I don't know what modern javascript engines use internally - (maybe
the "webasm" thing is
used internally as javascript bytecode) But you would be much more on
track transforming
CPython opcode into this Javascript internal dialect (or explicit
webasm, regardless
of the javascript engine), than lookng at Brython for that.
What Brython have of great is seamless integration with the webbrowser APIs
being able to call javascript methods of documents, and changing the DOM
just as javascript code does - if you get something compiling Python
to Webasm, it would be
interesting having some modules that could provide an interface to do the same.
(Remembering that _there_are_ projects out there that do just that:
build the CPython
in low level javascript - the resulting code can run Python code in an
amulated screen inside
the browser, but it can't as easily interact with the HTML DOM, which
makes Brython more
useful than that (I don't recall the name right now))
>
>
> Em 16 de fev de 2018 5:13 AM, "Kiko" <
kikoco...@gmail.com> escreveu:
>>
>>
>>
>> 2018-02-16 4:25 GMT+01:00 Igor Machado <
igor.m...@gmail.com>:
>>>
>>> Dear brython developers,
>>> first of all, your project is quite amazing!
>>> I used it some time ago and was impressed by how easy it was to integrate
>>> python in a browser...
>>> My new challenge involving python and js depends on byteplay3 library for
>>> python. It is a very low level library that depends on stuff that is
>>> intended for python 3.5 (I guess).
>>> I spent almost a month dealing with low level details of python 3.5, and
>>> it seems to have changed a lot since 3.3, so I wonder how Brython developers
>>> are intending to move on this direction (supporting 3.5 or byteplay3).
>>
>>
>> I don't think it has much sense to use byteplay with brython. Brython
>> doesn't generate bytecode and doesn't follow the same internals than
>> CPython. Brython is a transpiler of Python to Javascript on the fly.
>> Also, some libs imported by byteplay3 are coded in C in CPython (array,
>> opcode,...) and they are not yet ported to Brython.
>>
>> I hope it helps.
>>
>>>
>>> Thanks a lot and congratulations for the nice work so far!
>>>
>>> Igor M. Coelho
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "brython" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to
brython+u...@googlegroups.com.
>>
brython+u...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "brython" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
brython+u...@googlegroups.com.
>
https://groups.google.com/d/msgid/brython/CALdJCQWKpJNq2-h5e0ypFqji6qs3UXFm%3DbxScotihuo4G_cj3g%40mail.gmail.com.