@ -395,27 +395,27 @@ to_exclusive = <range>.stop
< / code > < / pre > < / div >
< pre > < code class = "text language-text" > +------------------+----------+------------+----------+
| | Sequence | Collection | Iterable |
+------------------+----------+------------+----------+
| list, range, str | yes | yes | yes |
| dict, set | | yes | yes |
| iter | | | yes |
+------------------+----------+------------+----------+
< pre > < code class = "text language-text" > +------------------+------------ +------------+-- ----------+
| | Sequence | Collection | Iterable |
+------------------+------------ +------------+-- ----------+
| list, range, str | yes | yes | yes |
| dict, set | | yes | yes |
| iter | | | yes |
+------------------+------------ +------------+-- ----------+
< / code > < / pre >
< pre > < code class = "python language-python hljs" > < span class = "hljs-meta" > > > > < / span > < span class = "hljs-keyword" > from< / span > numbers < span class = "hljs-keyword" > import< / span > Integral, Rational, Real, Complex, Number
< span class = "hljs-meta" > > > > < / span > isinstance(< span class = "hljs-number" > 123< / span > , Number)
< span class = "hljs-keyword" > True< / span >
< / code > < / pre >
< pre > < code class = "text language-text" > +--------------------+----------+----------+--------+---------+--------+
| | Integral | Rational | Real | Complex | Number |
+--------------------+----------+----------+--------+---------+--------+
| int | yes | yes | yes | yes | yes |
| fractions.Fraction | | yes | yes | yes | yes |
| float | | | yes | yes | yes |
| complex | | | | yes | yes |
| decimal.Decimal | | | | | yes |
+--------------------+----------+----------+--------+---------+--------+
< pre > < code class = "text language-text" > +--------------------+----------+----------+---------- +- ---------+-- --------+
| | Integral | Rational | Real | Complex | Number |
+--------------------+----------+----------+---------- +- ---------+-- --------+
| int | yes | yes | yes | yes | yes |
| fractions.Fraction | | yes | yes | yes | yes |
| float | | | yes | yes | yes |
| complex | | | | yes | yes |
| decimal.Decimal | | | | | yes |
+--------------------+----------+----------+---------- +- ---------+-- --------+
< / code > < / pre >
< div > < h2 id = "string" > < a href = "#string" name = "string" > #< / a > String< / h2 > < pre > < code class = "python language-python hljs" > < str> = < str> .strip() < span class = "hljs-comment" > # Strips all whitespace characters from both ends.< / span >
< str> = < str> .strip(< span class = "hljs-string" > '< chars> '< / span > ) < span class = "hljs-comment" > # Strips all passed characters from both ends.< / span >
@ -531,32 +531,32 @@ to_exclusive = <range>.stop
{< span class = "hljs-number" > 1.23456< / span > :< span class = "hljs-number" > 10.3< / span > %} < span class = "hljs-comment" > # ' 123.456%'< / span >
< / code > < / pre > < / div >
< div > < h4 id = "comparisonoffloatpresentationtypes" > Comparison of float presentation types:< / h4 > < pre > < code class = "text language-text" > +---------------- +----------------+---------------+----------------+-----------------+
| | {< float> } | {< float> :f} | {< float> :e} | {< float> :%} |
+---------------- +----------------+---------------+----------------+-----------------+
| 0.000056789 | '5.6789e-05' | '0.000057' | '5.678900e-05' | '0.005679%' |
| 0.00056789 | '0.00056789' | '0.000568' | '5.678900e-04' | '0.056789%' |
| 0.0056789 | '0.0056789' | '0.005679' | '5.678900e-03' | '0.567890%' |
| 0.056789 | '0.056789' | '0.056789' | '5.678900e-02' | '5.678900%' |
| 0.56789 | '0.56789' | '0.567890' | '5.678900e-01' | '56.789000%' |
| 5.6789 | '5.6789' | '5.678900' | '5.678900e+00' | '567.890000%' |
| 56.789 | '56.789' | '56.789000' | '5.678900e+01' | '5678.900000%' |
| 567.89 | '567.89' | '567.890000' | '5.678900e+02' | '56789.000000%' |
+---------------- +----------------+---------------+----------------+-----------------+
< / code > < / pre > < / div >
< pre > < code class = "text language-text" > +---------------- +----------------+---------------+----------------+-----------------+
| | {< float> :.2} | {< float> :.2f} | {< float> :.2e} | {< float> :.2%} |
+---------------- +----------------+---------------+----------------+-----------------+
| 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' |
| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |
| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |
| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |
| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |
| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
+---------------- +----------------+---------------+----------------+-----------------+
< div > < h4 id = "comparisonoffloatpresentationtypes" > Comparison of float presentation types:< / h4 > < pre > < code class = "text language-text" > +---------------+- ----------------+----------------- +- ----------------+-----------------+
| | {< float> } | {< float> :f} | {< float> :e} | {< float> :%} |
+---------------+- ----------------+----------------- +- ----------------+-----------------+
| 0.000056789 | '5.6789e-05' | '0.000057' | '5.678900e-05' | '0.005679%' |
| 0.00056789 | '0.00056789' | '0.000568' | '5.678900e-04' | '0.056789%' |
| 0.0056789 | '0.0056789' | '0.005679' | '5.678900e-03' | '0.567890%' |
| 0.056789 | '0.056789' | '0.056789' | '5.678900e-02' | '5.678900%' |
| 0.56789 | '0.56789' | '0.567890' | '5.678900e-01' | '56.789000%' |
| 5.6789 | '5.6789' | '5.678900' | '5.678900e+00' | '567.890000%' |
| 56.789 | '56.789' | '56.789000' | '5.678900e+01' | '5678.900000%' |
| 567.89 | '567.89' | '567.890000' | '5.678900e+02' | '56789.000000%' |
+---------------+- ----------------+----------------- +- ----------------+-----------------+
< / code > < / pre > < / div >
< pre > < code class = "text language-text" > +---------------+- ----------------+----------------- +- ----------------+-----------------+
| | {< float> :.2} | {< float> :.2f} | {< float> :.2e} | {< float> :.2%} |
+---------------+- ----------------+----------------- +- ----------------+-----------------+
| 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' |
| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |
| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |
| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |
| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |
| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
+---------------+- ----------------+----------------- +- ----------------+-----------------+
< / code > < / pre >
< div > < h3 id = "ints" > Ints< / h3 > < pre > < code class = "python language-python hljs" > {< span class = "hljs-number" > 90< / span > :c} < span class = "hljs-comment" > # 'Z'< / span >
{< span class = "hljs-number" > 90< / span > :X} < span class = "hljs-comment" > # '5A'< / span >
@ -1204,17 +1204,17 @@ Hello World!
< / code > < / pre > < / div >
< div > < h4 id = "tableofrequiredandavailablespecialmethods" > Table of required and available special methods:< / h4 > < pre > < code class = "text language-text" > +------------+----------+------------+----------+--------------+
| | Iterable | Collection | Sequence | abc.Sequence |
+------------+----------+------------+----------+--------------+
| iter() | REQ | REQ | yes | yes |
| contains() | yes | yes | yes | yes |
| len() | | REQ | REQ | REQ |
| getitem() | | | REQ | REQ |
| reversed() | | | yes | yes |
| index() | | | | yes |
| count() | | | | yes |
+------------+----------+------------+----------+--------------+
< div > < h4 id = "tableofrequiredandavailablespecialmethods" > Table of required and available special methods:< / h4 > < pre > < code class = "text language-text" > +------------+------------ +------------+-- ----------+--------------+
| | Iterable | Collection | Sequence | abc.Sequence |
+------------+------------ +------------+-- ----------+--------------+
| iter() | REQ | REQ | yes | yes |
| contains() | yes | yes | yes | yes |
| len() | | REQ | REQ | REQ |
| getitem() | | | REQ | REQ |
| reversed() | | | yes | yes |
| index() | | | | yes |
| count() | | | | yes |
+------------+------------ +------------+-- ----------+--------------+
< / code > < / pre > < / div >
< ul >
@ -1327,14 +1327,14 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
+-- UnicodeError # Raised when encoding/decoding strings from/to bytes fails.
< / code > < / pre > < / div >
< div > < h4 id = "collectionsandtheirexceptions" > Collections and their exceptions:< / h4 > < pre > < code class = "text language-text" > +-----------+------------+----------+----------+
| | list | dict | set |
+-----------+------------+----------+----------+
| getitem() | IndexError | KeyError | |
| pop() | IndexError | KeyError | KeyError |
| remove() | ValueError | | KeyError |
| index() | ValueError | | |
+-----------+------------+----------+----------+
< div > < h4 id = "collectionsandtheirexceptions" > Collections and their exceptions:< / h4 > < pre > < code class = "text language-text" > +-----------+------------+------------ +-- ----------+
| | list | dict | set |
+-----------+------------+------------ +-- ----------+
| getitem() | IndexError | KeyError | |
| pop() | IndexError | KeyError | KeyError |
| remove() | ValueError | | KeyError |
| index() | ValueError | | |
+-----------+------------+------------ +-- ----------+
< / code > < / pre > < / div >
< div > < h3 id = "userdefinedexceptions" > User-defined Exceptions< / h3 > < pre > < code class = "python language-python hljs" > < span class = "hljs-class" > < span class = "hljs-keyword" > class< / span > < span class = "hljs-title" > MyError< / span > < span class = "hljs-params" > (Exception)< / span > :< / span >
@ -1586,17 +1586,17 @@ shutil.copytree(from, to) <span class="hljs-comment"># Copies the enti
< li > < strong > < code class = "python hljs" > < span class = "hljs-string" > 'lineterminator'< / span > < / code > - How does writer terminate lines.< / strong > < / li >
< li > < strong > < code class = "python hljs" > < span class = "hljs-string" > 'quoting'< / span > < / code > - Controls the amount of quoting: 0 - as necessary, 1 - all.< / strong > < / li >
< li > < strong > < code class = "python hljs" > < span class = "hljs-string" > 'escapechar'< / span > < / code > - Character for escaping 'quotechar' if 'doublequote' is false.< / strong > < / li >
< / ul > < div > < h3 id = "dialects" > Dialects< / h3 > < pre > < code class = "text language-text" > +------------------+-----------+-----------+--------------+
| | excel | excel_tab | unix_dialect |
+------------------+-----------+-----------+--------------+
| delimiter | ',' | '\t' | ',' |
| quotechar | '"' | '"' | '"' |
| doublequote | True | True | True |
| skipinitialspace | False | False | False |
| lineterminator | '\r\n' | '\r\n' | '\n' |
| quoting | 0 | 0 | 1 |
| escapechar | None | None | None |
+------------------+-----------+-----------+--------------+
< / ul > < div > < h3 id = "dialects" > Dialects< / h3 > < pre > < code class = "text language-text" > +------------------+-------------- +--- -----------+--------------+
| | excel | excel_tab | unix_dialect |
+------------------+-------------- +--- -----------+--------------+
| delimiter | ',' | '\t' | ',' |
| quotechar | '"' | '"' | '"' |
| doublequote | True | True | True |
| skipinitialspace | False | False | False |
| lineterminator | '\r\n' | '\r\n' | '\n' |
| quoting | 0 | 0 | 1 |
| escapechar | None | None | None |
+------------------+-------------- +--- -----------+--------------+
< / code > < / pre > < / div > < / div >
@ -1885,29 +1885,29 @@ param_names = list(<sig>.parameters.keys())
type(MyMetaClass) == type < span class = "hljs-comment" > # MyMetaClass is an instance of type.< / span >
< / code > < / pre > < / div >
< pre > < code class = "text language-text" > +---------+-------------+
| Classes | Metaclasses |
+---------+-------------|
| MyClass > MyMetaClass |
| | v |
| object ---> type < + |
| | ^ +---+ |
| str -------+ |
+---------+-------------+
< pre > < code class = "text language-text" > +------------- +-------------+
| Classes | Metaclasses |
+------------- +-------------|
| MyClass -- > MyMetaClass |
| | v |
| object -- ---> type < + |
| | ^ +---+ |
| str -- -------+ |
+------------- +-------------+
< / code > < / pre >
< div > < h3 id = "inheritancediagram" > Inheritance Diagram< / h3 > < pre > < code class = "python language-python hljs" > MyClass.__base__ == object < span class = "hljs-comment" > # MyClass is a subclass of object.< / span >
MyMetaClass.__base__ == type < span class = "hljs-comment" > # MyMetaClass is a subclass of type.< / span >
< / code > < / pre > < / div >
< pre > < code class = "text language-text" > +---------+-------------+
| Classes | Metaclasses |
+---------+-------------|
| MyClass | MyMetaClass |
| v | v |
| object < --- type |
| ^ | |
| str | |
+---------+-------------+
< pre > < code class = "text language-text" > +------------- +-------------+
| Classes | Metaclasses |
+------------- +-------------|
| MyClass | MyMetaClass |
| v | v |
| object < -- --- type |
| ^ | |
| str | |
+------------- +-------------+
< / code > < / pre >
< div > < h2 id = "eval" > < a href = "#eval" name = "eval" > #< / a > Eval< / h2 > < pre > < code class = "python language-python hljs" > < span class = "hljs-meta" > > > > < / span > < span class = "hljs-keyword" > from< / span > ast < span class = "hljs-keyword" > import< / span > literal_eval
< span class = "hljs-meta" > > > > < / span > literal_eval(< span class = "hljs-string" > '1 + 2'< / span > )