Character Primitives¶
[1]:
from rich.console import Console
from byteclasses.print import byteclass_info, byteclass_inspect
from byteclasses.types.primitives.characters import SChar, UChar
console = Console()
[2]:
uchar = UChar("A")
byteclass_info(uchar)
byteclass_inspect(uchar)
Byteclass Info ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ type() │ UChar │ │ is_byteclass() │ True │ │ is_collection_instance() │ False │ │ is_primitive_instance() │ True │ │ mro │ UChar -> UInt8 -> _PrimitiveInt -> _PrimitiveNumber -> _Primitive -> ABC -> object │ │ len() │ 1 │ │ str() │ A │ │ repr() │ UChar('A') │ │ .data │ b'A' │ │ .value │ A │ └──────────────────────────┴────────────────────────────────────────────────────────────────────────────────────┘
╭────────────────── Byteclass Inspect ───────────────────╮ │ 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f │ │ ---------------------------------------------------- │ │ 0x0 |41 │ ╰────────────────────────────────────────────────────────╯
Legend ┏━━━━━━━┓ ┃ Value ┃ ┡━━━━━━━┩ │ A │ └───────┘
[3]:
console.print(f"{uchar.signed=}")
uchar.signed=False
[4]:
schar = SChar(65)
byteclass_info(schar)
byteclass_inspect(schar)
Byteclass Info ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Property ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ type() │ SChar │ │ is_byteclass() │ True │ │ is_collection_instance() │ False │ │ is_primitive_instance() │ True │ │ mro │ SChar -> Int8 -> _PrimitiveInt -> _PrimitiveNumber -> _Primitive -> ABC -> object │ │ len() │ 1 │ │ str() │ 65 │ │ repr() │ SChar(65) │ │ .data │ b'A' │ │ .value │ 65 │ └──────────────────────────┴───────────────────────────────────────────────────────────────────────────────────┘
╭────────────────── Byteclass Inspect ───────────────────╮ │ 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f │ │ ---------------------------------------------------- │ │ 0x0 |41 │ ╰────────────────────────────────────────────────────────╯
Legend ┏━━━━━━━┓ ┃ Value ┃ ┡━━━━━━━┩ │ 65 │ └───────┘
[5]:
console.print(f"{schar.signed=}")
schar.signed=True