[Python-Dev] async/await in Python; v2
Steven D'Aprano
steve at pearwood.info
Fri Apr 24 15:17:54 CEST 2015
On Thu, Apr 23, 2015 at 01:51:52PM -0400, Barry Warsaw wrote:
> Why "async def" and not "def async"?
>
> My concern is about existing tools that already know that "def" as the first
> non-whitespace on the line starts a function/method definition. Think of a
> regexp in an IDE that searches backwards from the current line to find the
> function its defined on. Sure, tools can be updated but it is it *necessary*
> to choose a syntax that breaks tools?
Surely its the other way? If I'm searching for the definition of a
function manually, I search for "def spam". `async def spam` will still
be found, while `def async spam` will not.
It seems to me that tools that search for r"^\s*def\s+spam\s*\(" are
going to break whichever choice is made, while a less pedantic search
like r"def\s+spam\s*\(" will work only if async comes first.
--
Steve
More information about the Python-Dev
mailing list