Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
would python3.3 make things change in tornado?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
momiji1  
View profile  
 More options Nov 7 2012, 10:05 pm
From: momiji1 <slove...@gmail.com>
Date: Wed, 7 Nov 2012 19:05:16 -0800 (PST)
Local: Wed, Nov 7 2012 10:05 pm
Subject: would python3.3 make things change in tornado?

python3.3 released days ago. the biggest new feature is yield from

http://docs.python.org/3/whatsnew/3.3.html#pep-380

Would that make coding easier?

in previous version, if you want to make gen.task work at somewhere, you
must modify all functions at the very beginning passing a callback. though
most of the callback is meaningless.

in 3.3. you can simply use yield from to call the function, you don't have
to make all functions become asynchronous ,isn't it?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Darnell  
View profile  
 More options Nov 8 2012, 10:06 am
From: Ben Darnell <b...@bendarnell.com>
Date: Thu, 8 Nov 2012 07:06:16 -0800
Local: Thurs, Nov 8 2012 10:06 am
Subject: Re: [tornado] would python3.3 make things change in tornado?

On Wed, Nov 7, 2012 at 7:05 PM, momiji1 <slove...@gmail.com> wrote:
> python3.3 released days ago. the biggest new feature is yield from

> http://docs.python.org/3/whatsnew/3.3.html#pep-380

> Would that make coding easier?

> in previous version, if you want to make gen.task work at somewhere, you
> must modify all functions at the very beginning passing a callback. though
> most of the callback is meaningless.

> in 3.3. you can simply use yield from to call the function, you don't have
> to make all functions become asynchronous ,isn't it?

Python 3.3 does offer some improvements for generator-based code,
especially the fact that you can have "yield" and "return" in the same
function, so you don't need to pass callbacks around explicitly.  You can
use some parts of this with @gen.engine today:

  @gen.engine
  def foo(args, callback):
    # Entry points must still take callbacks and be decorated with
@gen.engine
    yield gen.Task(...)

    # Undecorated generators can be called with yield from
    result = yield from async_helper(args)
    callback(result)

  def async_helper(args):
    # Functions called with "yield from" do not take a callback and are not
decorated.
    # Objects yielded here will be passed through to the caller's
gen.engine wrapper
    x = yield gen.Task(...)
    return result

Unfortunately, to take full advantage of this (and remove the dichotomy
between entry points that need decorators and callbacks, and inner
functions that must not have either) you need a generator scheduler that
was designed with "yield from" in mind.  Such a scheduler would only work
in Python 3.3+, so it will be a while before I'm willing to put something
like that in Tornado itself.  However, there is talk of adding a "yield
from"-based async framework to the standard library in python 3.4.

-Ben


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »