You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vamos começar a projetar a API para essa classe escrevendo em uma sessão de console simulada,
386
386
que depois podemos usar como um doctest.
@@ -571,7 +571,7 @@ mostrando como elas são criadas a partir de métodos especiais.
571
571
[role="width-70"]
572
572
[[collection_uml]]
573
573
.Diagrama de classes UML com os tipos fundamentais de coleções. Métodos como nome em _itálico_ são abstratos, então precisam ser implementados pelas subclasses concretas, tais como `list` e `dict`. O restante dos métodos tem implementações concretas, então as subclasses podem herdá-los.
574
-
image::images/flpy_0102.png[Diagram de classes UML com todas as superclasses e algumas subclasses de `abc.Collection`]
574
+
image::../images/flpy_0102.png[Diagram de classes UML com todas as superclasses e algumas subclasses de `abc.Collection`]
575
575
576
576
Cada uma das ABCs no topo da hierarquia tem um único método especial.
577
577
A ABC `Collection` (introduzida n Python 3.6) unifica as três interfaces essenciais,
@@ -627,10 +627,13 @@ A maioria desses métodos será tratado ao longo do livro, incluindo as adiçõe
627
627
métodos especiais assíncronos como `+__anext__+` (acrescentado n Python 3.5), e o método de personalização de classes, `+__init_subclass__+` (d Python 3.6).
628
628
629
629
////
630
-
PROD: Please make sure funcion names such as divmod() and __truediv__ are not broken at line breaks in the table cells. Thanks!
631
-
I put all the method names in each table cell inside a single code markup `x` because if each name is in a separate ``, then the space between the names looks too small.
632
-
If it's too hard to increase the space between the words, then we could put a semicolon between them. In the first edition we used colons but it looked like a tiny defect.
633
-
I tried to use keep-together in <<special_operators_tbl>> but it was rendering a 0 (zero) instead of the content within the <code> element.
630
+
PROD: Please make sure funcion names such as divmod() and __truediv__ are not
631
+
broken at line breaks in the table cells. Thanks!
632
+
I put all the method names in each table cell inside a single code markup `x`
633
+
because if each name is in a separate ``, then the space between the names looks too small.
634
+
If it's too hard to increase the space between the words, then we could put a semicolon between them.
635
+
In the first edition we used colons but it looked like a tiny defect.
636
+
I tried to use keep-together in <special_operators_tbl> but it was rendering a 0 (zero) instead of the content within the <code> element.
634
637
////
635
638
636
639
[[special_names_tbl]]
@@ -640,7 +643,7 @@ I tried to use keep-together in <<special_operators_tbl>> but it was rendering a
640
643
|Categoria|Nomes dos métodos
641
644
|Representação de string/bytes|`+__repr__ __str__ __format__ __bytes__ __fspath__+`
642
645
|Conversão para número|`+__bool__ __complex__ __int__ __float__ __hash__ __index__+`
643
-
|Emulação de coleções|pass:[<code>__len__ __getitem__ __setitem__ __delitem__ </code><span class="keep-together"><code>__contains__</code></span>]
646
+
|Emulação de coleções|`+__len__ __getitem__ __setitem__ __delitem__ __contains__+`
Aqui os nomes mais recentes são `+__matmul__+`, `+__rmatmul__+`, e `+__imatmul__+`, adicionados n Python 3.5 para suportar o uso de `@` como um operador infixo de multiplicação de matrizes, como veremos no <<ch_op_overload>>.((("special methods", "special method names and symbols for operators")))
659
+
Aqui os nomes mais recentes são `+__matmul__+`, `+__rmatmul__+`, e `+__imatmul__+`,
660
+
adicionados n Python 3.5 para suportar o uso de `@` como operador de multiplicação de matrizes,
661
+
como veremos no <<ch_op_overload>>.((("special methods", "special method names and symbols for operators")))
658
662
659
663
[[special_operators_tbl]]
660
664
.Nomes e símbolos de métodos especiais para operadores
@@ -664,7 +668,7 @@ Aqui os nomes mais recentes são `+__matmul__+`, `+__rmatmul__+`, e `+__imatmul_
0 commit comments