3,377 questions
3
votes
1
answer
4k
views
BaseEventLoop.run_in_executor() throws "unexpected keyword argument 'callback'" starting in Python 3.5
I am running a function, provision_ec2_node(), via the default asyncio event loop thread executor. The function takes a number of arguments which I pass to the executor via functools.partial().
task =...
16
votes
2
answers
6k
views
python 3.5 type hints: can i check if function arguments match type hints?
does python 3.5 provide functions that allow to test whether a given
argument would fit the type hints given in the function declaration?
if i have e.g. this function:
def f(name: List[str]):
...
22
votes
10
answers
78k
views
PyCharm doesn't detect interpreter
I want to use PyCharm, so I downloaded and installed it (v. 4.5, community edition). I had previously installed Python 3.5 64-bit from python.org (I'm using Windows 10).
To start using PyCharm, I need ...
57
votes
2
answers
35k
views
How to use async/await in Python 3.5?
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
async def foo():
await time.sleep(1)
foo()
I couldn't make this dead simple example to run:
RuntimeWarning: coroutine 'foo' was never ...
4
votes
1
answer
811
views
Which Windows SDK to use to build extensions for Python 3.5?
Python 3.5 for Windows is built with Visual Studio 2015:
Microsoft Visual Studio 2015, which is the compiler used to build the official Python releases
Which version of the Windows SDK should you ...
16
votes
1
answer
9k
views
Is it possible to inherit from class with Generic in Python?
Since Python 3.5 you can use Generics and other interesting stuff described in PEP-0484.
I tried that and here's a code I have:
from typing import TypeVar, Generic, Optional
...
_T = TypeVar('T')
...
3
votes
3
answers
3k
views
"pip3 install numpy" fails on brewed Python 3.5
I use OS X Yosemite with a Homebrew-installed Python 3.5.
Trying to install NumPy with pip3 install numpy results in the following error
Traceback (most recent call last):
File "<string>"...
359
votes
4
answers
174k
views
What are type hints in Python 3.5?
One of the most talked-about features in Python 3.5 is type hints.
An example of type hints is mentioned in this article and this one while also mentioning to use type hints responsibly. Can someone ...
24
votes
2
answers
21k
views
How to use await expression?
Couldn't figure out how to use await from python 3.5-rc2
>>> async def foo():
... pass
...
>>> await foo()
File "<ipython-input-10-a18cb57f9337>", line 1
await foo()...
-1
votes
1
answer
239
views
What are the last four tokens of Python 3.5 grammar?
https://docs.python.org/3.5/library/token.html
What are last four tokens about in the token definition of Python 3.5 grammar?
-3
votes
1
answer
52
views
Calling list.index(a) results in attribute call, not method?
I've been trying to create a script that takes lists inside a dictionary, and edits them to create a grid-like thing. I'm trying to make a variable equivalent to the index of a value in the list, but ...
2
votes
1
answer
38
views
installing virtualenvwrapper causes untested argparse to be installed
I have installed virtualenvwrapper in a 3.5.0b1 virtualenv, called setupenv, to be able to generate new python 3.5 test environments easily.
Looking over the list of installed packages, I did see ...
17
votes
3
answers
34k
views
Importing bs4 in Python 3.5
I have installed both Python 3.5 and Beautifulsoup4. When I try to import bs4, I get the error below. Is there any fix for that? Or should I just install Python 3.4 instead?
Please be very explicit - ...
244
votes
4
answers
125k
views
What is the '@=' symbol for in Python?
I know @ is for decorators, but what is @= for in Python? Is it just reservation for some future idea?
This is just one of my many questions while reading tokenizer.py.