π
<-
Chat plein-écran
[^]

Le Python et la Nspire enfin réunis grâce à "Micro Python" !

:32tins: :32tinsktpb: :32tinsktpn: :32tinscas: :32tinstpkc: :32tinstpktpb: :32tinstp: :32tinscastp: :32tinscmc: :32tinscx: :32tinscxcas:

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Lionel Debroux » 26 Jan 2015, 17:19

En effet.

Dans le détail: https://github.com/micropython/micropython mentionne actuellement explicitement
Micro Python implements the entire Python 3.4 syntax (including exceptions, "with", "yield from", etc.). The following core datatypes are provided: str (no Unicode support yet), bytes, bytearray, tuple, list, dict, set, array.array, collections.namedtuple, classes and instances. Builtin modules include sys, time, and struct. Note that only subset of Python 3.4 functionality implemented for the data types and modules.


Le projet python-on-a-chip (p14p, PyMite), plus ancien, n'implémentait pas tout.
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.2%
 
Posts: 6859
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Vogtinator » 27 Sep 2015, 11:12

Here is a beta version of micropython, based on upstream version v1.4.6-30-g3ab40ba-dirty.
There might be some new bugs, some fixes and some other horrible and nice things included.
If you encounter any issues, please report them on GitHub.
If you want to check out the source code, it's on GitHub as well, branch "next": https://github.com/Vogtinator/micropython/tree/next
Attachments
micropython.tns
Micropython v1.4.6-30-g3ab40ba-dirty
(269.33 KiB) Downloaded 91 times
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Bisam » 27 Sep 2015, 12:55

Wow, the new file is half-sized ! Did you remove anything ?

Why didn't you include the "randomizer" I saw as an example in some func ? Random functions clearly are missing, for example if one wants to make any game.

Will there be any more existing modules included later (e.g. "os", "random", "time", "functools") ?

PS : As for now, I tested all the files I had on calc and didn't find any bug.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5666
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Vogtinator » 27 Sep 2015, 13:29

Bisam wrote:Wow, the new file is half-sized ! Did you remove anything ?

Nope, I even enabled some new upstream features, like uzlib, ujson, ure, uheapq, uhashlib, ubinascii and probably most useful, machine,
which makes direct memory read/writes possible. I had to enable Zehn compression as the resulting tns was almost a MiB in size...

Why didn't you include the "randomizer" I saw as an example in some func ? Random functions clearly are missing, for example if one wants to make any game.

How should it be implemented?

Will there be any more existing modules included later (e.g. "os", "random", "time", "functools") ?

There is https://github.com/micropython/micropython-lib, but porting that (or even parts) would be a huge amount of work.

PS : As for now, I tested all the files I had on calc and didn't find any bug.

Great, thanks for testing!
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Bisam » 27 Sep 2015, 13:39

Vogtinator wrote:How should it be implemented ?

Well, a "rand" function added to the "nsp" module, for example (this function returning a random number in ]0,1[ ). It would be enough, I think.
The one implemented here should make it...
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5666
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Ti64CLi++ » 27 Sep 2015, 15:36

Comment utiliser le module nsp?
Est-ce que la fonction help() existe?
Comment savoir la liste des fonctions dans un module?
Merci d'avance
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.4%
 
Posts: 3443
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Bisam » 27 Sep 2015, 15:52

1) Import nsp
2) pas de fonction "help"
3) dir(module)
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5666
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Ti64CLi++ » 27 Sep 2015, 15:53

Merci beaucoup Bisam
Pour le 1), je voulais en fait savoir comment utiliser les fonctions ;)
Et comment je peux savoir la syntaxe d'une fonction, et comment générer des nombres pseudos-aléatoires?
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.4%
 
Posts: 3443
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Bisam » 27 Sep 2015, 21:44

Une fois que tu as importé un module nommé "machin" en faisant import machin, tu utilises la fonction "truc" du module en faisant machin.truc(..).
Pour savoir comment l'utiliser, y'a pas vraiment le choix : il faut avoir un exemple ou bien faire des tests car l'interpréteur n'a pas d'autocomplétion, et les attributs __doc__ ne semblent pas fonctionner.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5666
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: Le Python et la Nspire enfin réunis grâce à "Micro Pytho

Unread postby Ti64CLi++ » 28 Sep 2015, 12:31

Merci beaucoup Bisam pour tes réponses ;)
Dommage, il faudrait reporter cette amélioration a faire a Vogtinator :D
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.4%
 
Posts: 3443
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

PreviousNext

Return to News TI-Nspire

Who is online

Users browsing this forum: No registered users and 50 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1403 utilisateurs:
>1375 invités
>23 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)