Re: [Python-Dev] Importance of "async" keyword

2015-06-30 Thread Sven R. Kunze

Hi,

I have never said I wanted implicit asyncio. Explicit is the Python way 
after all, it served me well and I stick to that.


I like the 'await' syntax to mark suspension points. But the 'async' 
coloring makes no sense to me. It is an implementation details of 
asyncio (IMHO).



From what I can gather, there are 4 distinct cases I would need to take 
care of. However, I do not wish the team to go through of all of them. 
Additionally, they would even need to think of whether a function 
returns an 'awaitable that returns an int', an 'int' or both depending 
on the input parameters (or due to an implementation error). Maybe, 
somebody even makes a crazy error like returning an 'awaitable that 
returns an awaitable that returns an int'. If somebody likes to 
create/handle this kind of stuff (for whatever reason), using the 
asyncio library and creating crazy wrapper objects would be the way to 
go; not the default syntax.



Regards,
Sven
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Capturing PyRun_String stdout

2015-06-30 Thread Chris Moller

I expect this has been asked before, but I can't find out much about it...

I'm trying to embed Python as a scripting language and I need to capture 
the output of PyRun_String(), PyEval_EvalCode(), or whatever as a char * 
(or wchar_t * or whatever) rather than have it go to stdout.


Python 3.3.2 under plain C, not C++

And, while I'm interrupting everyone's afternoon, another question: if 
I  pass Py_single_input to PyRun_String() or 
Py_CompileString()/PyEval_EvalCode(), it accepts statements like "a=10" 
and can then properly do stuff like "print(a)".  If I use Py_eval_input 
instead, I get error messages.  In both cases, I'm using the same 
global_dict and local_dict, if that makes any difference.  What am I 
doing wrong?


Thanks,
Chris Moller
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Capturing PyRun_String stdout

2015-06-30 Thread Amaury Forgeot d'Arc
Hi,

2015-06-30 21:40 GMT+02:00 Chris Moller :

>  I expect this has been asked before, but I can't find out much about it...
>

Please ask this kind of questions on the python-users mailing list
 (or comp.lang.python).

There you will find helpful people who will tell you how to modify
sys.stdout, and the differences between exec() and eval().

Best of luck using Python!


> I'm trying to embed Python as a scripting language and I need to capture
> the output of PyRun_String(), PyEval_EvalCode(), or whatever as a char *
> (or wchar_t * or whatever) rather than have it go to stdout.
>
> Python 3.3.2 under plain C, not C++
>
> And, while I'm interrupting everyone's afternoon, another question: if I
> pass Py_single_input to PyRun_String() or
> Py_CompileString()/PyEval_EvalCode(), it accepts statements like "a=10" and
> can then properly do stuff like "print(a)".  If I use Py_eval_input
> instead, I get error messages.  In both cases, I'm using the same
> global_dict and local_dict, if that makes any difference.  What am I doing
> wrong?
>
> Thanks,
> Chris Moller
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/amauryfa%40gmail.com
>
>


-- 
Amaury Forgeot d'Arc
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com