Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81561 > unrolled thread
| Started by | Kasper Peeters <kasper@phi-sci.com> |
|---|---|
| First post | 2014-11-26 11:40 +0000 |
| Last post | 2014-11-26 11:40 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: PyEval_GetLocals and unreferenced variables Kasper Peeters <kasper@phi-sci.com> - 2014-11-26 11:40 +0000
| From | Kasper Peeters <kasper@phi-sci.com> |
|---|---|
| Date | 2014-11-26 11:40 +0000 |
| Subject | Re: PyEval_GetLocals and unreferenced variables |
| Message-ID | <mailman.16319.1417002046.18130.python-list@python.org> |
> To be honest, that's just made it even more weird :) You're creating > something in a local namespace that the Python compiler isn't aware > of. Yes, I agree that retrieving the locals with PyEval_GetLocals and then sticking something in there on the C side is weird. I wouldn't say that the Python compiler is not aware of it though (I could ask my question purely in Python: how do I check in the scope of fun2 whether 'q' is available in the outer scope without actually using it). > I wonder, would a 'nonlocal q' declaration inside fun2 affect things > any? Yes, that pulls in 'q', but I would like to do that 'nonlocal q' on the C side. If I have to write 'nonlocal q' inside fun2 then I can also pull in 'q' using any other reference to 'q'. > Otherwise, maybe there's some completely different way to transfer > information around. Using locals in this way seems fraught with peril. There might very well be... Cheers, Kasper
Back to top | Article view | comp.lang.python
csiph-web