diff --git a/python23six.html b/python23six.html
index 112ab01..624e1fc 100644
--- a/python23six.html
+++ b/python23six.html
@@ -58,25 +58,132 @@
Por que Python 3?
-
-
-
-
-
python -3 [script]
2to3
2to3
arrumaprint
não vai funcionar (é função)iter*
não vai funcionarurlib
mudou tudourlparse
mudou tudo(%
para formatar strings
+ retornou, 2to3
não muda para format()
)
__future__
!import collections
+
+class Model(object):
+ def __init__(self, word):
+ self._count = None
+ self.word = word
+ return
+
+ @property
+ def word(self):
+ return self._word
+
+ @word.setter
+ def word(self, word):
+ self._word = word
+ self._count = collections.Counter(word)
+
+ @property
+ def letters(self):
+ return self._count
+
+ def __getitem__(self, pos):
+ return self._count[pos]
+
+
+if __name__ == "__main__":
+ word = Model('This is an ex-parrot')
+ for letter, count in word.letters.iteritems():
+ print letter, count
+
+ class Model(object):
Todas as classes são new style, mas Python 3 não + reclama disso.
+for letter, count in word.letters.iteritems():
iteritems()
não existe mais no Python 3.
Python 3 tem apenas items()
,
+ que funciona de forma diferente no Python 2.
items()
no Python 2 gera uma
+ lista inteira nova ao invés de ser um iterador.
print letter, count
print
agora é uma função.
Algumas funcionalidades mudaram (por exemplo, não há + mais espaço entre itens).
+