Skip to content

Commit 46ad915

Browse files
authored
Merge pull request #120 from scart97/add_comments_signature
Comment explaining signature fix on L
2 parents 938c46b + 251eea7 commit 46ad915

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

nbs/01_foundation.ipynb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,18 @@
17281728
],
17291729
"source": [
17301730
"#hide\n",
1731+
"\n",
1732+
"# Here we are fixing the signature of L. What happens is that\n",
1733+
"# the __call__ method on the MetaClass of L shadows the __init__\n",
1734+
"# giving the wrong signature [1].\n",
1735+
"\n",
1736+
"# The solution adopted tries to not import the inspect module \n",
1737+
"# inside the lib code (notice that this cell is not exported)\n",
1738+
"# because it's really slow, but instead relies on pickling the\n",
1739+
"# correct signature and loading it.\n",
1740+
"\n",
1741+
"# [1] https://stackoverflow.com/questions/49740290/call-from-metaclass-shadows-signature-of-init\n",
1742+
"\n",
17311743
"def _f(items=None, *rest, use_list=False, match=None): ...\n",
17321744
"pickle.dumps(inspect.signature(_f))"
17331745
]

0 commit comments

Comments
 (0)