Cet article traitant du module TI-Python est préparé dans des conditions inconfortables : nous ne disposons pas du module, l'article est rédigé a posteriori et illustré à l’aide des photos de tests prises sur le stand de Texas Instruments aux journées APMEP 2018 puis congrès UdPPC 2018 avec le prototype.
Certaines photos ne correspondront pas exactement à ce qui a été rédigé, et les informations apportées peuvent être ou devenir inexactes. En vous priant de bien vouloir nous en excuser.
Certaines photos ne correspondront pas exactement à ce qui a été rédigé, et les informations apportées peuvent être ou devenir inexactes. En vous priant de bien vouloir nous en excuser.
Lors de notre premier article nous n'avions pas pu t'illustrer ce qu'offrait le module random car ayant omis de le prendre en photo. Comme promis réparons aujourd'hui cela en explorant ce module à l'aide du script suivant :
- Code: Select all
#platforms: (0)TI-Nspire (1)NumWorks (2)Graph 90+E (3)Graph 75+E (4)TI-Python
plines=[29,12, 7, 9,11]
pcols =[53,99,509,32,32]
platform=0
try:
import sys
try:
if sys.platform=='nspire': platform=0
if sys.platform=='TI-Python Adapter': platform=4
except: platform=3
except:
try:
import kandinsky
platform=1
except:
platform=2
nlines=plines[platform]
ncols=pcols[platform]
curline=0
def mprint(*ls):
global curline
st=""
for s in ls:
if not(isinstance(s,str)):
s=str(s)
st=st+s
stlines=1+int(len(st)/ncols)
if curline+stlines>=nlines:
input("Input to continue:")
curline=0
print(st)
curline+=stlines
def sstr(obj):
try:
s=obj.__name__
except:
s=str(obj)
a=s.find("'")
b=s.rfind("'")
if a>=0 and b!=a:
s=s[a+1:b]
return s
def explmod(pitm,pitmsl=[],reset=True):
global curline
if(reset):
curline=0
pitmsl=[sstr(pitm)]
hd="."*(len(pitmsl)-1)
spath=".".join(pitmsl)
c=0
for itms in sorted(dir(pitm)):
c=c+1
try:
itm=eval(spath+"."+itms)
mprint(hd+itms+"="+str(itm))
if spath.rfind(itms)<0:
pitmsl2=pitmsl.copy()
pitmsl2.append(itms)
c=c+explmod(itm,pitmsl2,False)
except:
mprint(hd+itms)
if c>0:
mprint(hd+"Total: "+str(c)+" item(s)")
return c
Le script nous liste alors pas moins de 30 entrées retranscrites ci-dessous :
TI-Python wrote:>>> from explmod import *
>>> import random
>>> explmod(random)
__name__='random'
.count()=<bound_method>
.endswith()=<bound_method>
.find()=<bound_method>.format()=<bound_method>
.index()=<bound_method>
.isalpha()=<bound_method>
.isdigit()=<bound_method>
.islower()=<bound_method>
.isspace()=<bound_method>
.isupper()=<bound_method>
.join()=<bound_method>
.lower()=<bound_method>
.lstrip()=<bound_method>.replace()=<bound_method>
.rfind()=<bound_method>
.rindex()=<bound_method>
.rsplit()=<bound_method>
.rstrip()=<bound_method>
.split()=<bound_method>
.startswith()=<bound_method>
.strip()=<bound_method>
.upper()=<bound_method>Total: 22 item(s)
choice()=<function>
getrandbits()=<function>
randint()=<function>
random()=<function>
randrange()=<function>
seed()=<function>
uniform()=<function>
Total: 30 item(s)
30
>>>
Voici ci-dessous la comparaison de ce que renvoient les différents modèles disposant d'une implémentation Python en lançant ce même script :
__name__='random' choice() getrandbits() randint() random() randrange() seed() uniform() | |
Total: 0 | Total: 30 |
Et oui, égalité pour tout-le-monde sauf la TI-Nspire qui n'intègre pas le module random pourtant essentiel au lycée.

D'où le classement suivant :
- NumWorks, Casio Graph 35+E/75+E, Casio Graph 90+E et module TI-Python pour TI-83 Premium CE avec 30 entrées
- TI-Nspire avec 0 entrées