Il 26 dicembre 2012 09:33, Valerio Pachera <siri...@gmail.com> ha scritto: > Sto leggendo e provando le differenze fra python 2 e 3 > http://docs.python.org/3.0/whatsnew/3.0.html > Cosa ne pensate di questo: > --- > d = {'uno':1, 'due':2, 'tre':3, 'quattro':4} > > for key in d.keys(): > print (key) > > quattro > tre > due > uno > --- > Stampa le chiavi dell'array dall'ultima alla prima.
Non mi sembra una differenza tra python 2 e 3, sul mio netbook:: miron@aspie:~$ python2 Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d = {'uno':1, 'due':2, 'tre':3, 'quattro':4} >>> for key in d.keys(): ... print (key) ... quattro tre due uno >>> miron@aspie:~$ python3 Python 3.2.3 (default, Oct 19 2012, 19:53:57) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d = {'uno':1, 'due':2, 'tre':3, 'quattro':4} >>> for key in d.keys(): ... print (key) ... quattro tre due uno >>> La cosa *davvero* strana, e` che vale solo per i numeri da uno a quattro, e solo se scritti in italiano. >>> d['cinque'] = 5 >>> for key in d.keys(): ... print (key) ... quattro cinque tre due uno Sara` perche` l'autore del linguaggio si chiama Guido? PS: <http://docs.python.org/3.3/library/collections.html#collections.OrderedDict> Cheers, © -- R K-<M>-S L _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python