Select in Python

2006-06-26 Thread Dio
#!/usr/bin/env python2

from sys import stdin
from select import select

while 1:
(rr, wr, er) = select([stdin], [], [])
for fd in rr:
print fd

program block in the first select(), after I type something and "enter
", it never block in select() again,why?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Select in Python

2006-06-26 Thread Dio

K.S.Sreeram 写道:

> Dio wrote:
> > while 1:
> > (rr, wr, er) = select([stdin], [], [])
> > for fd in rr:
> > print fd
> >
> > program block in the first select(), after I type something and "enter
> > ", it never block in select() again,why?
>
> select blocks until there is some data to read from stdin, but it does
> not *clear* the data. so once you enter data, select will not block
> until you read the data. once you're done reading the available data,
> you can again use select to block until more data is available.
>
> Regards
> Sreeram

Thanks a lot!I use stdin.readline() after select and it's ok :)

-- 
http://mail.python.org/mailman/listinfo/python-list

ArtWork in PyPyBox - Pure Python

2016-03-30 Thread Salvatore DI DIO
In pure Python, here is a nice image (for me at least)

http://salvatore.diodev.fr/pypybox/

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Transcrypt - Games for Kids

2016-06-27 Thread Salvatore DI DIO
Hello,

I am using Transcrypt  (Python to Javascript translator) to create
games for kids, and introduce them to  programming.
You can give an eye here :

https://github.com/artyprog/GFK

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


RapydScript : Python to Javascript translator

2013-11-17 Thread Salvatore DI DIO
Hello,

If someone  is interested about a fast Python to Javascript translator (not a 
compiler like Brython which is another beast)

Here is a link of a RapydScript Tester.
For now it's only for windows.

Regards

http://salvatore.pythonanywhere.com/static/Projects/RapydScriptDemo.exe

(I can if there is needs publish it for mac and linux)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Thanks Amirouche,

I am now balanced between RapydScript and Pythonium :-)


Le dimanche 17 novembre 2013 20:17:44 UTC+1, Amirouche Boubekki a écrit :
> Héllo Pythonistas from all over the world,
> 
> 
> 
> I'm very proud to announce the immediate availability of Pythonium Core 
> 0.2.5, a Python 3 to Javascript translator (the best) that generates *fast* 
> *portable* code written in Python.
> 
> 
> 
> 
> It use Python 3 parser and translates the code to JavaScript code.
> 
> 
> I did not say “it's fully compliant” because it's not. That's not the point 
> of this flavor. Its point is to make possible to write Python code and use it 
> in the browsers. All the objects stay vanilla Javascript objects. There is no 
> builtins, no stdlib, except what is available in the wild, because Pythonium 
> can access Javascript objects directly, you can use *whatever* JavaScript 
> library you want.
> 
> 
> 
> 
> There is port of the mrdoob webgl cloud demo available 
> 
> watch: http://pythonium.github.io/
> read: https://github.com/pythonium/pythonium.github.io/blob/master/js/app.py
> 
> 
> 
> 
> The project is hosted at github: https://github.com/pythonium/pythonium
> 
> 
> Don't hesitate to watch/star/fork/create/pr ! Like said earlier, it's the 
> best translator I know of, and it's written in Python.
> 
> 
> 
> 
> 
> How do you get started ?
> ==
> 
> 
> If you know JavaScript it's easy you don't need guidance. Don't forget to 
> read the cookook 
> https://github.com/pythonium/pythonium/wiki/Pythonium-Core-Cookbook
> 
> 
> 
> 
> If you only know backend or desktop Python development, it will be a bit more 
> work. What you can do is take a jQuery or Javascript course, and translate 
> the code on the fly to Python, compile it using the pythonium_core and and 
> run it in nodejs or a browser. Good luck!
> 
> 
> 
> 
> 
> What's next?
> ==
> 
> 
> 
> Now, basicly, I don't know what to do!
> 
> Except bugs in requirejs integration, I don't except to commit more on this 
> flavor of Pythonium, so I could work on  more compliant flavors until 
> reaching full compliance with Python 3.
> 
> 
> 
> 
> BUT, this is not very interesting, having full compliance is nice, but you 
> loose native javascript speed (meh!) I'd rather be working on the next killer 
> todo list or some Kivy-like library for the browser using Pythonium Core.
> 
> 
> 
> 
> What do you think?
> 
> 
> 
> Amirouche

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Porting Kivy would be really great.


Le dimanche 17 novembre 2013 20:17:44 UTC+1, Amirouche Boubekki a écrit :
> Héllo Pythonistas from all over the world,
> 
> 
> 
> I'm very proud to announce the immediate availability of Pythonium Core 
> 0.2.5, a Python 3 to Javascript translator (the best) that generates *fast* 
> *portable* code written in Python.
> 
> 
> 
> 
> It use Python 3 parser and translates the code to JavaScript code.
> 
> 
> I did not say “it's fully compliant” because it's not. That's not the point 
> of this flavor. Its point is to make possible to write Python code and use it 
> in the browsers. All the objects stay vanilla Javascript objects. There is no 
> builtins, no stdlib, except what is available in the wild, because Pythonium 
> can access Javascript objects directly, you can use *whatever* JavaScript 
> library you want.
> 
> 
> 
> 
> There is port of the mrdoob webgl cloud demo available 
> 
> watch: http://pythonium.github.io/
> read: https://github.com/pythonium/pythonium.github.io/blob/master/js/app.py
> 
> 
> 
> 
> The project is hosted at github: https://github.com/pythonium/pythonium
> 
> 
> Don't hesitate to watch/star/fork/create/pr ! Like said earlier, it's the 
> best translator I know of, and it's written in Python.
> 
> 
> 
> 
> 
> How do you get started ?
> ==
> 
> 
> If you know JavaScript it's easy you don't need guidance. Don't forget to 
> read the cookook 
> https://github.com/pythonium/pythonium/wiki/Pythonium-Core-Cookbook
> 
> 
> 
> 
> If you only know backend or desktop Python development, it will be a bit more 
> work. What you can do is take a jQuery or Javascript course, and translate 
> the code on the fly to Python, compile it using the pythonium_core and and 
> run it in nodejs or a browser. Good luck!
> 
> 
> 
> 
> 
> What's next?
> ==
> 
> 
> 
> Now, basicly, I don't know what to do!
> 
> Except bugs in requirejs integration, I don't except to commit more on this 
> flavor of Pythonium, so I could work on  more compliant flavors until 
> reaching full compliance with Python 3.
> 
> 
> 
> 
> BUT, this is not very interesting, having full compliance is nice, but you 
> loose native javascript speed (meh!) I'd rather be working on the next killer 
> todo list or some Kivy-like library for the browser using Pythonium Core.
> 
> 
> 
> 
> What do you think?
> 
> 
> 
> Amirouche

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Pythonium Core 0.2.5

2013-11-17 Thread Salvatore DI DIO
Are lists comprehensions are featured in Veloce ?

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Salvatore DI DIO

> 
> I don't know about other people here, but I'm a bit leery of just
> 
> downloading Windows binaries from people and running them. Is your
> 
> source code available? Is this an open source / free project?
> 
> 
> 
> ChrisA

You are completly right :-)
Here is the source code :

https://github.com/charleslaw/rapydscript_online

You can see other demos here :

http://salvatore.pythonanywhere.com/RapydScript

The official site of RapydScript :

http://rapydscript.pyjeon.com/

e assumptions before testing :

Here is the official site:

http://rapydscript.pyjeon.com/ 

Regards 

Salvatore




-- 
https://mail.python.org/mailman/listinfo/python-list


Source code of Python to Javascsript translator

2013-11-18 Thread Salvatore DI DIO

>
> I don't know about other people here, but I'm a bit leery of just
>
> downloading Windows binaries from people and running them. Is your
>
> source code available? Is this an open source / free project?
>
>
>
> ChrisA

You are completly right :-)
Here is the source code :

https://github.com/charleslaw/rapydscript_online

You can see other demos here :

http://salvatore.pythonanywhere.com/RapydScript

The official site of RapydScript :

http://rapydscript.pyjeon.com/

e assumptions before testing :

Here is the official site:

http://rapydscript.pyjeon.com/

Regards

Salvatore 
-- 
https://mail.python.org/mailman/listinfo/python-list


RapydBox

2014-02-04 Thread Salvatore DI DIO
Hello,

For those of you who are interested by tools like NodeBox or Processing.
you can give a try to RapydScript here :

https://github.com/artyprog/RapydBox

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Hello,

I know Python does not have variables, but names.
Multiple names cant then be bound to the same objects.

So this behavior 

>>> b = 234
>>> v = 234
>>> b is v
True

according to the above that is ok



But where is the consistency ? if I try :

>>> v = 890
>>> w = 890
>>> v is w
False

It is a little difficult to explain this behavior to a newcommer in Python

Can someone give me the right argument to expose ?

Regards

-- 
https://mail.python.org/mailman/listinfo/python-list


Explaining names vs variables in Python (follow)

2016-03-02 Thread Salvatore DI DIO
Thank you very much all of you.
I better understand now

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Explaining names vs variables in Python

2016-03-02 Thread Salvatore DI DIO
Thank you very much ast and all of you. 

I better understant now

Regards

-- 
https://mail.python.org/mailman/listinfo/python-list


Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Hy all,

I am experimenting PyPyJS and found it not so bad at all.
The virtual machine loads on a few seconds (using firefox).

It s really nice for  learning Python, you have all the standard libraries,
and traceback on errors. I don't have to choose anymore with all transpilers 
around

You can try it here, but please don't tell it s too long to load the VM.
After all, don't you wait when you start a desktop application, or an heavy 
game online ?

Just try it and tell your feeling

Regards

http://salvatore.diodev.fr/pypybox/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit :
> Hy all,
> 
> I am experimenting PyPyJS and found it not so bad at all.
> The virtual machine loads on a few seconds (using firefox).
> 
> It s really nice for  learning Python, you have all the standard libraries,
> and traceback on errors. I don't have to choose anymore with all transpilers 
> around
> 
> You can try it here, but please don't tell it s too long to load the VM.
> After all, don't you wait when you start a desktop application, or an heavy 
> game online ?
> 
> Just try it and tell your feeling
> 
> Regards
> 
> http://salvatore.diodev.fr/pypybox/

Use Firefox...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit :
> Le 19/03/2016 16:32, Salvatore DI DIO a écrit :
> > Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit :
> >> Hy all,
> >>
> >> I am experimenting PyPyJS and found it not so bad at all.
> >> The virtual machine loads on a few seconds (using firefox).
> >>
> >> It s really nice for  learning Python, you have all the standard libraries,
> >> and traceback on errors. I don't have to choose anymore with all 
> >> transpilers around
> >>
> >> You can try it here, but please don't tell it s too long to load the VM.
> >> After all, don't you wait when you start a desktop application, or an 
> >> heavy game online ?
> >>
> >> Just try it and tell your feeling
> >>
> >> Regards
> >>
> >> http://salvatore.diodev.fr/pypybox/
> > Use Firefox...
> 
> That's look fine but:
> 
>PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
>   4917 vincent   20   0 1081m 305m  52m R *50.3* 15.4   5:23.75 firefox
>   1094 root  20   0 48152  15m 7180 S *35.0*  0.8   4:43.28 Xorg
>   5421 vincent   20   0  162m  14m  10m R  2.0  0.7   0:02.49 mate-terminal
>  1 root  20   0  3660 1984  ...
> 
> 85.3 % (50.3 + 35) CPU usage just for a rotating square it's too much cost.
> 
> Vincent

Thank you for testing :-)
Strange on Windows I have an average 6% CPU with Firefox 45.0.1

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit :
> Le 19/03/2016 16:32, Salvatore DI DIO a écrit :
> > Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit :
> >> Hy all,
> >>
> >> I am experimenting PyPyJS and found it not so bad at all.
> >> The virtual machine loads on a few seconds (using firefox).
> >>
> >> It s really nice for  learning Python, you have all the standard libraries,
> >> and traceback on errors. I don't have to choose anymore with all 
> >> transpilers around
> >>
> >> You can try it here, but please don't tell it s too long to load the VM.
> >> After all, don't you wait when you start a desktop application, or an 
> >> heavy game online ?
> >>
> >> Just try it and tell your feeling
> >>
> >> Regards
> >>
> >> http://salvatore.diodev.fr/pypybox/
> > Use Firefox...
> 
> That's look fine but:
> 
>PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
>   4917 vincent   20   0 1081m 305m  52m R *50.3* 15.4   5:23.75 firefox
>   1094 root  20   0 48152  15m 7180 S *35.0*  0.8   4:43.28 Xorg
>   5421 vincent   20   0  162m  14m  10m R  2.0  0.7   0:02.49 mate-terminal
>  1 root  20   0  3660 1984  ...
> 
> 85.3 % (50.3 + 35) CPU usage just for a rotating square it's too much cost.
> 
> Vincent

Here is a screenshot

http://salvatore.diodev.fr/pypybox/static/images/pypyjs.png
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 19:52:45 UTC+1, Terry Reedy a écrit :
> On 3/19/2016 1:06 PM, Salvatore DI DIO wrote:
> > Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit :
> >> Le 19/03/2016 16:32, Salvatore DI DIO a écrit :
> >>> Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit :
> >>>> Hy all,
> >>>>
> >>>> I am experimenting PyPyJS and found it not so bad at all.
> >>>> The virtual machine loads on a few seconds (using firefox).
> >>>>
> >>>> It s really nice for  learning Python, you have all the standard 
> >>>> libraries,
> >>>> and traceback on errors. I don't have to choose anymore with all 
> >>>> transpilers around
> >>>>
> >>>> You can try it here, but please don't tell it s too long to load the VM.
> >>>> After all, don't you wait when you start a desktop application, or an 
> >>>> heavy game online ?
> >>>>
> >>>> Just try it and tell your feeling
> >>>>
> >>>> Regards
> >>>>
> >>>> http://salvatore.diodev.fr/pypybox/
> >>> Use Firefox...
> >>
> >> That's look fine but:
> >>
> >> PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
> >>4917 vincent   20   0 1081m 305m  52m R *50.3* 15.4   5:23.75 firefox
> >>1094 root  20   0 48152  15m 7180 S *35.0*  0.8   4:43.28 Xorg
> >>5421 vincent   20   0  162m  14m  10m R  2.0  0.7   0:02.49 
> >> mate-terminal
> >>   1 root  20   0  3660 1984  ...
> >>
> >> 85.3 % (50.3 + 35) CPU usage just for a rotating square it's too much cost.
> >>
> >> Vincent
> >
> > Thank you for testing :-)
> > Strange on Windows I have an average 6% CPU with Firefox 45.0.1
> 
> Win10, same FF, 6 core pentium, 1% +- CPU, 110 MB memory increase.
> 
> 
> -- 
> Terry Jan Reedy

Thanks Terry
-- 
https://mail.python.org/mailman/listinfo/python-list


Nodebox(v1) on the web via RapydScript

2013-10-03 Thread Salvatore DI DIO
Hello,

Nodebox is a program in the spirit of Processing but for Python.

The first version runs only on MAC.
Tom, the creator has partly ported it to Javascript.

But many of you dislike Javascript.
The solution was to use a translator,  Python -> Javascript

Of the both two greats solutions Brython / RapydScript, I've choosen RapydScript
(Brython and RapydScript does not achieve the same goal)

You can see a preview of 'Nodebox on the Web' namely 'RapydBox' here :

http://salvatore.pythonanywhere.com/RapydBox

Regards




-- 
https://mail.python.org/mailman/listinfo/python-list


Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Hello,

I was trying to show that this limit was 'e'
But when I try large numbers I get errors

def lim(p):
return math.pow(1 + 1.0 / p , p)

>>> lim(5)
2.718281748862504
>>> lim(9)
2.7182820518605446  


What am i doing wrong ?

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Oscar,I was considerind using Mapple :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Chris

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Salvatore DI DIO
Thank you very much Oscar, I was considering using Mapple :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-10 Thread Salvatore DI DIO
Thank you very much Peter
-- 
https://mail.python.org/mailman/listinfo/python-list