Questions tagged [python-3.9]

A version of the Python programming language, first released on October 5, 2020. This tag is for issues that are specific to Python 3.9. For general questions use the more generic [python] and [python-3.x] tags.

3.9 was released on October 5, 2020 (PEP 596).


Use this tag if your question is specifically related to Python 3.9. 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

1128 questions
224
votes
7 answers

Python version <= 3.9: Calling class staticmethod within the class body?

When I attempt to use a static method from within the body of the class, and define the static method using the built-in staticmethod function as a decorator, like this: class Klass(object): @staticmethod # use as decorator def…
martineau
  • 119,623
  • 25
  • 170
  • 301
114
votes
3 answers

What are "soft keywords"?

According to the documentation of the keyword module, two new members have been added in Python 3.9: issoftkeyword softkwlist However their documentation doesn't reveal anything about their purpose. This change is not even mentioned in the What's…
a_guest
  • 34,165
  • 12
  • 64
  • 118
98
votes
6 answers

AttributeError: module 'importlib' has no attribute 'util'

I've just upgraded from Fedora 32 to Fedora 33 (which comes with Python 3.9). Since then gcloud command stopped working: [guy@Gandalf32 ~]$ gcloud Error processing line 3 of…
Guy Carmin
  • 983
  • 1
  • 5
  • 4
93
votes
3 answers

How to install python with conda?

I'm trying to install python 3.9 in a conda enviroment. I tried creating a new conda env using the following command, conda create --name myenv python=3.9 But I got an error saying package not found because python 3.9 is not yet released So, I…
bigbounty
  • 16,526
  • 5
  • 37
  • 65
63
votes
1 answer

pip3 on python3.9 fails on 'HTMLParser' object has no attribute 'unescape'

After installing (ubuntu) python3.9, installing some packages with pip failes on: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 14, in…
borgr
  • 20,175
  • 6
  • 25
  • 35
59
votes
4 answers

What is __peg_parser__ in Python?

I was using the keyword built-in module to get a list of all the keywords of the current Python version. And this is what I did: >>> import keyword >>> print(keyword.kwlist) ['False', 'None', 'True', '__peg_parser__', 'and', 'as', 'assert', 'async',…
abhigyanj
  • 2,355
  • 2
  • 9
  • 29
31
votes
5 answers

How can I run Python 3.9.1 natively on M1 Mac?

Seems to be impossible currently with Anaconda as well as with Xcode 12. Via idle, it runs via Rosetta. There seems to be no discussion of this so either I'm quite naive or maybe this will be useful to others as well. Python says: "As of 3.9.1,…
hithisispeter
  • 359
  • 1
  • 3
  • 5
26
votes
6 answers

Django - deterministic=True requires SQLite 3.8.3 or higher upon running python manage.py runserver

I am running a linux red hat environment from AWS. I have followed every instruction for upgrading sqlite3 to the "latest" version. I am running python 3.9.2 (and have recompiled it with LD_RUN_PATH=/usr/local/lib ./configure) and django version…
Shmack
  • 1,933
  • 2
  • 18
  • 23
18
votes
2 answers

Software based on Python 3.9 is not working on Windows 7

I made a standalone software using python3.9 which properly works on my system and another windows 10 system also, but I tried running that software on Windows 7 Ultimate and it shows some errors. Please note that I made the software by binding all…
Tushar Agarwal
  • 191
  • 1
  • 1
  • 7
17
votes
1 answer

What is the difference between cached_property in Django vs. Python's functools?

Django has a decorator called cached_property which can be imported from django.utils.functional. On the other hand, Python 3.8 added cached_property to the standard library which can be imported from functools. Are both equivalent, i.e., are they…
lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
14
votes
2 answers

When will AWS lambda support python 3.9?

Hi does anyone know how can I find out when will AWS lambda upgrade their support to python 3.9? Last time they upgraded to 3.8 was 2019 and it’s been a while since v3.9 released. I’m keen to use the latest v3.9 language features but sadly can’t do…
James H
  • 531
  • 6
  • 15
13
votes
1 answer

Is there a way to use Python 3.9 type hinting in its previous versions?

In Python 3.9 we can use type hinting in a lowercase built-in fashion (without having to import type signatures from the typing module) as described here: def greet_all(names: list[str]) -> None: for name in names: print("Hello",…
kbnt
  • 143
  • 1
  • 6
13
votes
4 answers

Tensorflow in python 3.9 Installation error : failure to install tensorflow [WinError 2]

While installing TensorFlow on Windows having python 3.9 installed using the following command: pip install tensorflow Following error occurred with the warning: WARNING: Failed to write executable - trying to use .deleteme logic ERROR: Could not…
Prajwal R
  • 117
  • 1
  • 1
  • 8
11
votes
3 answers

Python how to type anotate a method that returns self?

Suppose I have a class that implements method chaining: from __future__ import annotations class M: def set_width(self, width: int)->M: self.width = width return self def set_height(self, height: int)->M: …
mousetail
  • 7,009
  • 4
  • 25
  • 45
10
votes
2 answers

walrus operator in dict comprehension

I wanted to avoid double evaluation of a mean in a dict comprehension, and I tried using the walrus operator: >>> dic = {"A": [45,58,75], "B": [55,82,80,92], "C": [78,95,90], "D":[98,75]} >>> q = {x: (mean := (sum(dic[x]) // len(dic[x]))) for x in…
1
2 3
74 75