19 Sep
2015
19 Sep
'15
6:30 a.m.
On Sat, Sep 19, 2015 at 10:49 AM, Andrew Barnert
Obviously "spam?" returns something with a __getattr__ method that just passes through to spam.__getattr__, except that on NoneType it returns something with a __getattr__ that always returns None. That solves the eggs case.
Next, "spam?.cheese?" returns something with a __call__ method that just passed through to spam?.cheese.__call__, except that on NoneType it returns something with a __call__ that always returns None. That solves the cheese case.
Hang on, how do you do this? How does the operator know the difference between "spam?", which for None has to have __getattr__ return None, and "spam?.cheese?" that returns (lambda: None)? ChrisA