Re: Closures in metaclasses

2011-02-18 Thread zambr123
Hi there, We are currently looking for someone who has ideally several years coding experience, and who is familar with Network coding and the Python language. The project revolves around emulation and a chat based system, altough the vast majority of the project is focused on the chat

Closures in metaclasses

2010-01-21 Thread Falcolas
I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass, the closure appears to be lost when I access the final class. I end up getting the text 'param' instead of the actual tags I am expecting: ALL_TAGS = ['a', 'abbr', 'acronym

Re: Closures in metaclasses

2010-01-21 Thread Arnaud Delobelle
Falcolas garri...@gmail.com writes: I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass, the closure appears to be lost when I access the final class. I end up getting the text 'param' instead of the actual tags I am expecting

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 11:24 am, Arnaud Delobelle arno...@googlemail.com wrote: Falcolas garri...@gmail.com writes: I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass, the closure appears to be lost when I access the final class. I end

Re: Closures in metaclasses

2010-01-21 Thread Arnaud Delobelle
On Jan 21, 6:37 pm, Falcolas garri...@gmail.com wrote: On Jan 21, 11:24 am, Arnaud Delobelle arno...@googlemail.com wrote: Falcolas garri...@gmail.com writes: I'm running into an issue with closures in metaclasses - that is, if I create a function with a closure in a metaclass

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 12:10 pm, Arnaud Delobelle arno...@googlemail.com wrote: On Jan 21, 6:37 pm, Falcolas garri...@gmail.com wrote: On Jan 21, 11:24 am, Arnaud Delobelle arno...@googlemail.com wrote: It was the easiest way I found to add a lot of static methods to the Tag class without writing

Re: Closures in metaclasses

2010-01-21 Thread Peter Otten
Falcolas wrote: I tried overriding __getattr__ and got an error at runtime (the You can either move __getattr__() into the metaclass or instantiate the class. I prefer the latter. Both approaches in one example: class Tag: ... class __metaclass__(type): ... def

Re: Closures in metaclasses

2010-01-21 Thread Falcolas
On Jan 21, 1:55 pm, Peter Otten __pete...@web.de wrote: Falcolas wrote: I tried overriding __getattr__ and got an error at runtime (the You can either move __getattr__() into the metaclass or instantiate the class. I prefer the latter. Both approaches in one example: class Tag: ...    

Re: Closures in metaclasses

2010-01-21 Thread Arnaud Delobelle
Falcolas garri...@gmail.com writes: On Jan 21, 12:10 pm, Arnaud Delobelle arno...@googlemail.com wrote: [...] Or you could override __getattr__ -- Arnaud I tried overriding __getattr__ and got an error at runtime (the instance did not have xyz key, etc), and the Tag dict is not