Show only the necessary decimals

This commit is contained in:
Alexander Hess 2020-10-28 16:57:48 +01:00
commit ca9df9e440
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
6 changed files with 152 additions and 150 deletions

View file

@ -86,7 +86,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(f\"{x:.3f}\" for x in self)\n",
" args = \", \".join(repr(x) for x in self)\n",
" return f\"Vector(({args}))\"\n",
"\n",
" def __iter__(self):\n",
@ -115,7 +115,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(\"(\" + \", \".join(f\"{c:.3f}\" for c in r) + \",)\" for r in self._entries)\n",
" args = \", \".join(\"(\" + \", \".join(repr(c) for c in r) + \",)\" for r in self._entries)\n",
" return f\"Matrix(({args}))\"\n",
"\n",
" @property\n",
@ -160,7 +160,7 @@
{
"data": {
"text/plain": [
"Vector((1.000, 2.000, 3.000))"
"Vector((1.0, 2.0, 3.0))"
]
},
"execution_count": 4,
@ -208,7 +208,7 @@
{
"data": {
"text/plain": [
"Matrix(((1.000,), (2.000,), (3.000,)))"
"Matrix(((1.0,), (2.0,), (3.0,)))"
]
},
"execution_count": 6,
@ -267,7 +267,7 @@
{
"data": {
"text/plain": [
"Vector((1.000, 2.000, 3.000))"
"Vector((1.0, 2.0, 3.0))"
]
},
"execution_count": 8,
@ -315,7 +315,7 @@
{
"data": {
"text/plain": [
"Matrix(((1.000, 2.000, 3.000,)))"
"Matrix(((1.0, 2.0, 3.0,)))"
]
},
"execution_count": 10,
@ -363,7 +363,7 @@
{
"data": {
"text/plain": [
"Vector((1.000, 2.000, 3.000))"
"Vector((1.0, 2.0, 3.0))"
]
},
"execution_count": 12,
@ -682,7 +682,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(f\"{x:.3f}\" for x in self)\n",
" args = \", \".join(repr(x) for x in self)\n",
" return f\"Vector(({args}))\"\n",
"\n",
" def __len__(self):\n",
@ -790,7 +790,7 @@
{
"data": {
"text/plain": [
"Vector((2.000, 4.000, 6.000))"
"Vector((2.0, 4.0, 6.0))"
]
},
"execution_count": 24,
@ -814,7 +814,7 @@
{
"data": {
"text/plain": [
"Vector((3.000, 6.000, 9.000))"
"Vector((3.0, 6.0, 9.0))"
]
},
"execution_count": 25,
@ -910,7 +910,7 @@
{
"data": {
"text/plain": [
"Vector((0.333, 0.667, 1.000))"
"Vector((0.3333333333333333, 0.6666666666666666, 1.0))"
]
},
"execution_count": 28,
@ -945,7 +945,7 @@
{
"data": {
"text/plain": [
"Vector((2.000, 4.000, 6.000))"
"Vector((2.0, 4.0, 6.0))"
]
},
"execution_count": 29,
@ -969,7 +969,7 @@
{
"data": {
"text/plain": [
"Vector((0.000, 0.000, 0.000))"
"Vector((0.0, 0.0, 0.0))"
]
},
"execution_count": 30,
@ -1019,7 +1019,7 @@
{
"data": {
"text/plain": [
"Vector((101.000, 102.000, 103.000))"
"Vector((101.0, 102.0, 103.0))"
]
},
"execution_count": 32,
@ -1043,7 +1043,7 @@
{
"data": {
"text/plain": [
"Vector((99.000, 98.000, 97.000))"
"Vector((99.0, 98.0, 97.0))"
]
},
"execution_count": 33,
@ -1146,7 +1146,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(\"(\" + \", \".join(f\"{c:.3f}\" for c in r) + \",)\" for r in self._entries)\n",
" args = \", \".join(\"(\" + \", \".join(repr(c) for c in r) + \",)\" for r in self._entries)\n",
" return f\"Matrix(({args}))\"\n",
"\n",
" @property\n",
@ -1270,7 +1270,7 @@
{
"data": {
"text/plain": [
"Matrix(((10.000, 20.000, 30.000,), (40.000, 50.000, 60.000,), (70.000, 80.000, 90.000,)))"
"Matrix(((10.0, 20.0, 30.0,), (40.0, 50.0, 60.0,), (70.0, 80.0, 90.0,)))"
]
},
"execution_count": 37,
@ -1294,7 +1294,7 @@
{
"data": {
"text/plain": [
"Matrix(((1.000, 2.000, 3.000,), (4.000, 5.000, 6.000,), (7.000, 8.000, 9.000,)))"
"Matrix(((1.0, 2.0, 3.0,), (4.0, 5.0, 6.0,), (7.0, 8.0, 9.0,)))"
]
},
"execution_count": 38,
@ -1318,7 +1318,7 @@
{
"data": {
"text/plain": [
"Matrix(((0.000, 0.000, 0.000,), (0.000, 0.000, 0.000,), (0.000, 0.000, 0.000,)))"
"Matrix(((0.0, 0.0, 0.0,), (0.0, 0.0, 0.0,), (0.0, 0.0, 0.0,)))"
]
},
"execution_count": 39,
@ -1353,7 +1353,7 @@
{
"data": {
"text/plain": [
"Matrix(((138.000, 171.000, 204.000,), (174.000, 216.000, 258.000,)))"
"Matrix(((138.0, 171.0, 204.0,), (174.0, 216.0, 258.0,)))"
]
},
"execution_count": 40,
@ -1426,7 +1426,7 @@
{
"data": {
"text/plain": [
"Vector((14.000, 32.000, 50.000))"
"Vector((14.0, 32.0, 50.0))"
]
},
"execution_count": 42,
@ -1450,7 +1450,7 @@
{
"data": {
"text/plain": [
"Vector((30.000, 36.000, 42.000))"
"Vector((30.0, 36.0, 42.0))"
]
},
"execution_count": 43,
@ -1474,7 +1474,7 @@
{
"data": {
"text/plain": [
"Vector((68.000, 86.000))"
"Vector((68.0, 86.0))"
]
},
"execution_count": 44,
@ -1536,7 +1536,7 @@
{
"data": {
"text/plain": [
"Matrix(((101.000, 102.000, 103.000,), (104.000, 105.000, 106.000,), (107.000, 108.000, 109.000,)))"
"Matrix(((101.0, 102.0, 103.0,), (104.0, 105.0, 106.0,), (107.0, 108.0, 109.0,)))"
]
},
"execution_count": 46,
@ -1560,7 +1560,7 @@
{
"data": {
"text/plain": [
"Matrix(((99.000, 98.000, 97.000,), (96.000, 95.000, 94.000,), (93.000, 92.000, 91.000,)))"
"Matrix(((99.0, 98.0, 97.0,), (96.0, 95.0, 94.0,), (93.0, 92.0, 91.0,)))"
]
},
"execution_count": 47,
@ -1724,7 +1724,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(f\"{x:.3f}\" for x in self)\n",
" args = \", \".join(repr(x) for x in self)\n",
" return f\"Vector(({args}))\"\n",
"\n",
" def __len__(self):\n",
@ -1881,7 +1881,7 @@
{
"data": {
"text/plain": [
"Vector((1.000, 2.000, 3.000))"
"Vector((1.0, 2.0, 3.0))"
]
},
"execution_count": 58,
@ -1994,7 +1994,7 @@
" # ...\n",
"\n",
" def __repr__(self):\n",
" args = \", \".join(f\"{x:.3f}\" for x in self)\n",
" args = \", \".join(repr(x) for x in self)\n",
" return f\"Vector(({args}))\"\n",
"\n",
" def __iter__(self):\n",
@ -2058,7 +2058,7 @@
{
"data": {
"text/plain": [
"Vector((1.000, 2.000, 3.000))"
"Vector((1.0, 2.0, 3.0))"
]
},
"execution_count": 65,
@ -2106,7 +2106,7 @@
{
"data": {
"text/plain": [
"Vector((-3.000, -4.000))"
"Vector((-3.0, -4.0))"
]
},
"execution_count": 67,