Questions tagged [python-3.6]

Version of the Python programming language released in December 2016. For issues specific to Python 3.6. Use more generic [python] and [python-3.x] tags where possible.

Python 3.6 is the currently newest version of the popular Python programming language (see PEP 0494).

Use this tag if your question is specifically related to Python 3.6. Otherwise, use the following guidelines to determine which tag(s) you should add to your question:

  • If your question applies to Python in general, use only the tag.
  • If your question applies to Python 3.x but not to Python 2.x, add the tag .
  • If you aren't sure, tag your question with and mention which version you're using in the post.

References

5657 questions
87
votes
1 answer

what does --enable-optimizations do while compiling python?

I'm trying to compile Python 3.6 on an arm based Linux machine, ./configure outputs this: If you want a release build with all optimizations active (LTO, PGO, etc), please run ./configure --enable-optimizations. what does --enable-optimizations…
Yashar
  • 2,455
  • 3
  • 25
  • 31
76
votes
3 answers

Installing Python3.6 alongside Python3.7 on Mac

I'm trying to install tensorflow onto a Mac with Python3.7. However, I'm getting the error: $ pip3 -v install tensorflow ... Skipping link…
Sam
  • 2,172
  • 3
  • 24
  • 43
76
votes
5 answers

f-string syntax for unpacking a list with brace suppression

I have been examining some of my string format options using the new f-string format. I routinely need to unpack lists and other iterables of unknown length. Currently I use the following... >>> a = [1, 'a', 3, 'b'] >>> ("unpack a list: " + " {}…
NaN
  • 2,212
  • 2
  • 18
  • 23
73
votes
1 answer

Why are single type constraints disallowed in Python?

Suppose you want to constrain a type variable to implement a certain interface. You might write something like so: from typing import TypeVar, Callable T = TypeVar('T', Callable) class Foo(Generic[T]): ... >> TypeError: A single constraint is…
alcorn
  • 1,268
  • 1
  • 8
  • 17
72
votes
4 answers

String with 'f' prefix in python-3.6

I'm trying out Python 3.6. Going through new code, I stumbled upon this new syntax: f"My formatting string!" It seems we can do things like this: >>> name = "George" >>> print(f"My cool string is called {name}.") My cool string is called…
DevShark
  • 8,558
  • 9
  • 32
  • 56
70
votes
4 answers

How to call a async function from a synchronized code Python

So I'm locked to a python 3.6.2 interpreter that follows my desktop application. What I want is to call an async function from a synchronized method or function. When calling the python function from the desktop application it has to be a normal…
Paal Pedersen
  • 1,070
  • 1
  • 10
  • 13
68
votes
4 answers

How to compare a string with a python enum?

I just discovered the existence of an Enum base class in python and I'm trying to imagine how it could be useful to me. Let's say I define a traffic light status: from enum import Enum, auto class Signal(Enum): red = auto() green = auto() …
bli
  • 7,549
  • 7
  • 48
  • 94
62
votes
4 answers

How to connect to a remote PostgreSQL database through SSL with Python

I want to connect to a remote PostgreSQL database through Python to do some basic data analysis. This database requires SSL (verify-ca), along with three files (which I have): Server root certificate file Client certificate file Client key file I…
Alex
  • 978
  • 1
  • 9
  • 22
61
votes
1 answer

What's the difference between python3. and python3.m

What does the m stand for in python3.6m ? How does it differ to non m version? In which case would I prefer to use python3.6m rather than python3.6?
Michael D.
  • 1,795
  • 2
  • 18
  • 25
60
votes
2 answers

How to fix " DeprecationWarning: invalid escape sequence" in Python?

I'm getting lots of warnings like this in Python: DeprecationWarning: invalid escape sequence \A orcid_regex = '\A[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]\Z' DeprecationWarning: invalid escape sequence \/ AUTH_TOKEN_PATH_PATTERN =…
Sean Hammond
  • 12,550
  • 5
  • 27
  • 35
60
votes
2 answers

How to set up entry_points in setup.cfg

I am moving my config from setup.py to setup.cfg and having issues setting up the entry_points parameter. At the moment I am using a hybrid approach which works, however, I would like to move the entry_points to setup.cfg. From def setup_package(): …
user465374
  • 1,521
  • 4
  • 20
  • 39
60
votes
5 answers

Check a variable against Union type at runtime in Python 3.6

I'm trying to write a function decorator that uses Python 3.6 type hints to check that a dictionary of arguments respects the type hints and if not raise an error with a clear description of the problem, to be used for HTTP APIs. The problem is that…
Jacopofar
  • 3,407
  • 2
  • 19
  • 29
56
votes
3 answers

Python 3.6 No module named pip

I have just installed Python 3.6 on Fedora 25 (64 bits) by running dnf install python36 and I can't use any modules Python 3.5 can otherwise use just fine, for example, PyCharm complains about setup tools not being installed, also I can run python3…
arielnmz
  • 8,354
  • 9
  • 38
  • 66
53
votes
1 answer

NoReturn vs. None in "void" functions - type annotations in Python 3.6

Python 3.6 supports type annotation, like: def foo() -> int: return 42 But what is expected to use when a function hasn't return anything? PEP484 examples mostly use None as a return type, but there is also NoReturn type from typing…
ByAgenT
  • 651
  • 1
  • 6
  • 8
53
votes
6 answers

Why can't I install python3.6-dev on Ubuntu 16.04?

I am trying to install it with this command: sudo apt-get install python3.6-dev But I'm getting this error: E: Unable to locate package python3.6-dev E: Couldn't find any package by glob 'python3.6-dev' E: Couldn't find any package by regex…
Sanjit kumar
  • 681
  • 1
  • 6
  • 10