|
8 | 8 | - to_long() creates a (long) integer object from its input parameter. |
9 | 9 | - u() allows string literals involving non-ASCII characters to be |
10 | 10 | used in both Python 2.x / 3.x, e.g. u("\u0101 is a-with-macron") |
11 | | - - uchr() generates a single character Unicode string whose point code |
12 | | - is the given (integer) argument, e.g. uchr(257). |
13 | 11 | - unicod() forces its argument to a Unicode string. |
14 | 12 | - rpr() generates a representation of a string that can be parsed in either |
15 | 13 | Python 2.x or 3.x, assuming use of the u() function above. |
16 | 14 |
|
17 | | ->>> from .util import prnt, u, uchr, rpr |
| 15 | +>>> from .util import prnt, u, rpr |
18 | 16 | >>> prnt("hello") |
19 | 17 | hello |
20 | 18 | >>> prnt("hello", "world") |
|
23 | 21 | hello:world |
24 | 22 | >>> prnt("hello", "world", sep=":", end='!\\n') |
25 | 23 | hello:world! |
26 | | ->>> u('\u0101') == uchr(0x0101) |
27 | | -True |
28 | 24 | >>> u('\u0101') == u('\U00000101') |
29 | 25 | True |
30 | 26 | >>> u('\u0101') == u('\N{LATIN SMALL LETTER A WITH MACRON}') |
|
46 | 42 |
|
47 | 43 | unicod = str |
48 | 44 | u = str |
49 | | - uchr = chr |
50 | 45 | to_long = int |
51 | 46 |
|
52 | 47 | def prnt(*args, **kwargs): |
@@ -84,7 +79,6 @@ def u(s): |
84 | 79 | us = re.sub(_UNAME_RE, lambda m: unicodedata.lookup(m.group('name')), us) |
85 | 80 | return us |
86 | 81 |
|
87 | | - uchr = unichr |
88 | 82 | to_long = long |
89 | 83 |
|
90 | 84 | def prnt(*args, **kwargs): |
|
0 commit comments