question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python language level support (3.4/3.5/3.6/3.7)

See original GitHub issue

Python3.4

Done

bpo-15958: bytes.join and bytearray.join with arbitrary buffer objects (memoryview).

Probably Easy

pep 424: object.__length_hint__ is used by operator.length_hint if the length can’t be directly obtained

Unknown

pep 3156: Get asyncio to import properly (see issue #616 )

Python3.5

Done

pep 448: Allow multiple * and ** unpacking pep 448: Allow * and ** unpacking inside list, tuple, set, and dict literals.

Partial

pep 465: matrix multiplication operator a @ b currently supports __matmult__ and __imatmult__ but not __rmatmult__

Probably Easy

Pep 461: % formatting for bytes and bytearray bpo-9951: bytes.hex(), bytearray.hex() bpo-19235: RecursionError instead of RuntimeError on too much recursion

Unknown

bpo-9951: memoryview.hex() memoryview raises NotImplemented pep 492: async and await syntax bpo-24450: gi_yieldfrom attribute of generators returns inner iterables used by yield from PEP 479: generator_stop future import, which causes a RuntimeError if a generator throws StopIteration instead of returning

Python3.6

Done

pep 498: Format strings pep 468: Preserve keyword argument order – dicts preserve str key insertion order, but not int key insertion order. This is fine since dicts preserving key insertion order is an implementation detail of CPython 3.6. Preserving the string key insertion order means keyword argument order is properly preserved. pep 515: Ignore underscores in numeric literals

Probably Easy

pep 487: Call __init_subclass__() on new class creation, call __set_name__() on attributes implementing the descriptor protocol. Might be a bit tricky to get argumentless super() to work properly.

Unknown

pep 526: Syntax for variable annotations pep 525: Asynchronous generators pep 530: Asynchronous comprehensions

Python3.7

Done

async and await are now reserved keywords New Module: contextvars

Probably Easy

pep 563: Postpone evaluating type annotations pep 562: Allow __getattr__ at module level

Unknown

New Module: dataclasses fails to import with the same error as asyncio: ImportError: cannot import name 'unicode_iscased' (from _sre_utils)

Python3.8

Probably Easy

bpo-32489: Allow continue in finally clause bpo-33073: Add as_integer_ratio to int type. bpo-32117: Allow iterable unpacking in yield and return statements without parenthesis.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
PierreQuentelcommented, May 14, 2018

Resuming work on this old issue…

The commit referenced above makes bytes.join() and bytearray.join() work with memoryview and bytearray objects. PEP 424 already works.

1reaction
jonathanvernercommented, Aug 3, 2017

Re async features: I think these are actually very relevant in the browser. They can be used to avoid JavaScript callback hell (even JavaScript is getting async/await support): suppose, for example, that we want to chain a few AJAX calls, say we want to retrieve a list of friends of someone. The api allows us to find a user-id by his name, a list of friend_ids by user id and user info by id. Normal callback style would look something like this:


friend_list = []

def getUserID(username):
    req = XMLHttpRequest()
    req.get(api+'/'+user_name, getFriends)

def getFriends(user_id)
    req  = XMLHttpRequest()
    req.get(friend_list_url+'/+'user_id, getNames)

def getName(id_list):
     for id in id_list:
          req = XMLHttpRequest()
          req.get(api+'/user/'+id, lambda x: friend_list.append(x.name))

Compared with async style:


async def friend_list(name):
    ret = []
    id = await XMLHttpRequest(api+'/'+user_name)
    friend_ids = await XMLHttpRequest(riend_list_url+'/+'user_id)
    for id in friend_ids:
       friend = await XMLHttpRequest(api+'/user/'+id)
       ret.append(friend.name)
    return ret

The beauty of the async version (in my opinion at least) is that it is written as if the AJAX requests were synchronous. However, unlike synchronous requests, the async version doesn’t block the browser at all! Now all of this is doable with a little bit of generator magic which can already be implemented (see my port of asyncio, or the, hopefully coming soon, simpleaio rewrite) in Brython. The only difficult part (at least for me) is the syntactic sugar of being able to write

async def func():
    ...

instead of the more verbose

@coroutine
def func():
    ...

and

x = await func()

instead of

x = yield from func()

There are other async-related things, which would be nice to have:

  • asynchronous imports
  • running coroutines in webworkers

but these are not needed for compatibility with newer Python versions. And even here I am optimistic. It seems to me that async imports wouldn’t be too much harder than the recent changes (108f633590b74260dd361cd, 3a904a6852bdfc8ee840e8) Pierre made to input handling. But then again, I might be mistaken, I haven’t really gotten familiar enough with Brython’s compilation engine to try to implement it on my own. As far as webworkers are concerned, the main obstacle is that they don’t have access to the dom. But this shouldn’t be insurmountable…

Anyway, it seems that my comment has grown far too much and is probably off-topic. Do you think it makes sense to open a discussion on the google groups?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Python Tutorial — Python 3.11.1 documentation
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to ...
Read more >
Welcome to Python.org
The official home of the Python Programming Language.
Read more >
The Python Language Reference — Python 3.11.1 ...
This reference manual describes the syntax and “core semantics” of the language. It is terse, but attempts to be exact and complete.
Read more >
What is Python? Executive Summary
Python is an interpreted, object-oriented, high-level programming language ... Python supports modules and packages, which encourages program modularity and ...
Read more >
General Python FAQ — Python 3.11.1 documentation
What is Python good for?¶. Python is a high-level general-purpose programming language that can be applied to many different classes of problems. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found