Closed ghost closed 8 years ago
More:
E File "/home/cathal/Projects/python/schemato/schemato/schemas/opengraph.py", line 45
E def _is_instance(self, (subj, pred, obj)):
E ^
E SyntaxError: invalid syntax
PEP-3113 removed this sort of parameter unpacking, so that's why it doesn't work in Python 3.
The reason this appears not to work in Python 2 for you is that you forgot to name your function. 😄
# Python 2.7.12
In [1]: def packed_func((foo, bar, baz), qux):
...: pass
...:
In [2]:
Thanks for the help! Yea, I'm not going to fight this one any further. I can see why they removed that syntax from Python, I guess; it's a nice feature in another language, but Python really doesn't need it, and I can see how it confuses matters.
And, whoops; I'm getting too used to anonymous functions and I keep making that error when I return to Python. :)
Working on porting for #19, but I've encountered this gem and I'm flummoxed:
The idea of destructuring args is pretty cool, but it's not valid Python:
..so how did this ever get into the source tree? And if it does work, how do I get it to work for me, because I like it in principle? :)