-
Notifications
You must be signed in to change notification settings - Fork 646
Allow sys.stdout to be replaced #302
base: master
Are you sure you want to change the base?
Conversation
(should I follow the Google 2-space or PEP 4-space?)
Needs working __getattr__/__setattr__. Please wait if before merge
I have one thing to discuss here. |
I totally agree, but am not mature enough on Golang to glance the implications of this change. |
I believe that more modules will be needed. e.g (socketModule etc..) |
I would avoid __getattribute__ and instead use __getattr__. The latter is called only after nothing is found through normal attribute lookup, which is probably what we want in this case. |
Me too. But this rabbit hole is getting too deep! This |
Just to say, tracebacks would be very nice. Took me quite a bit to realize this 'res' typo |
@trotterdylan Are you ok with going on this way, and allow to use getattribute for now, or is better to go develop getattr before keep going on this PR? |
I think that __getattr__ should be fairly straightforward to implement. It needs a new slot and fallback logic in grumpy.GetAttr(). Also a few tests that validate the correct attribute resolution. |
Ok. Then I will chase __getattr__ on another PR. Everything else is ok? |
I think this is a little more complicated than I had hoped it would be. What if we get rid of the hybrid module concept and instead swap out sys.__dict__ something like this:
Currently __dict__ is not settable, but it will be once #331 is merged. |
Hum... the whole point of this PR is allow If Seems to still need an |
Right, so the trick would be get rid of the Stdout, Stdin and Stderr grumpy package members and instead pull those from SysDict like
I don't think this is necessary if we do the __dict__ assignment at the very top of the module. |
Please refer to the discussion on #290
Do not merge until
__getattr__
and__setattr__
is working.