Re: py_compile vs. built-in compile, with __future__

2013-06-11 Thread dhyams
On Tuesday, June 11, 2013 11:37:17 AM UTC-4, Neil Cerutti wrote: > On 2013-06-10, dhyams wrote: > > > On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: > > >> Can you read the file into a string, prepend a future directive, and > > >&

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: > On Tue, Jun 11, 2013 at 8:27 AM, dhyams wrote: > > > I guess I'll have to agree to disagree here...the situation I'm in is that > > I want a user to be able to write a mathematical plugin with as li

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
On Monday, June 10, 2013 4:59:35 PM UTC-4, Terry Jan Reedy wrote: > On 6/10/2013 11:33 AM, dhyams wrote: > > > The built-in compile() function has a "flags" parameter that one can > > > use to influence the "__future__" mechanism. However, > >

py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
The built-in compile() function has a "flags" parameter that one can use to influence the "__future__" mechanism. However, py_compile.compile, which I'm using to byte-compile code, doesn't have an equivalent means to do this. Is this by design, or would this be considered a bug? I'm just wantin

Re: How to mix-in __getattr__ after the fact?

2011-10-31 Thread dhyams
Thanks for all of the responses; everyone was exactly correct, and obeying the binding rules for special methods did work in the example above. Unfortunately, I only have read-only access to the class itself (it was a VTK class wrapped with SWIG), so I had to find another way to accomplish what I

How to mix-in __getattr__ after the fact?

2011-10-28 Thread dhyams
Python 2.7.2 I'm having trouble in a situation where I need to mix-in the functionality of __getattr__ after the object has already been created. Here is a small sample script of the situation: =snip import types class Cow(object): pass # this __getattr__ works as advertised.