Questions tagged [python-3.11]

Python 3.11 is the newest release of the Python language. Please use the [python] tag for general Python related questions.

Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation.

References

308 questions
1
vote
1 answer

dataclasses.asdict doesn't work on Python 3.11?

I tried the following code: from dataclasses import asdict, dataclass @dataclass class DC: a: int b: int c = DC(a=10, b=5) dc = asdict(c) print(dc) On Python 3.10 it works as expected, printing a dictionary as expected. When I try the…
zmbq
  • 38,013
  • 14
  • 101
  • 171
1
vote
0 answers

Referencing objects depends on relative and absolute import of a package

I have just faced with with behaviour I don't yet understand and don't know how to name it. I'll reproduce it here. Let's say we have a project with the structure as lined below. src │ __init__.py │ main.py │ └───utils │ __init__.py │ …
1
vote
1 answer

Python PyDash 'find' function returns Any instead of passed data type

The logic in my case is much more complex, but here is what it boils down to. I've got a list of dataclass instances. import pydash as pyd @dataclass class Info: color: str taste: str @dataclass class Fruit: id: int name: str …
tia
  • 13
  • 1
  • 4
1
vote
0 answers

How to solve a problem while trying install a pipenv with python 3.11?

Preconditions: python 3.11 pipenv 2022.12.19 Problem: I want to create a new pipenv virtual environment for my project with command: pipenv --python 3.11 or pipenv --python /usr/bin/python3.11 I have the next error: Loading .env environment…
Vadim Beglov
  • 343
  • 1
  • 4
  • 15
1
vote
1 answer

print repeating string with f-string

I can print(‘#’*5) to >>> #####. But if I try to do this with f-string like a=5 print(f” ‘#’*{a}”) I get >>> ‘#’*5. Is this not possible, or what is my failure?
Paul-ET
  • 68
  • 1
  • 6
1
vote
1 answer

How to implement threading into this? - typing speed tester

I am still a newbie when it comes to python coding so please be kind! I have been suggested to use threading to run both the 'timer' and the for/while loop together, but I am not sure if it's necessary or how to implement it at all. Being a beginner…
1
vote
1 answer

Tkinter: missing 1 required positional argument: 'self'

thanks in advance for your help. I'm learning about Tkinter and that's why I tried to write a simple code for a window where when I type a number and click on the ("trocar cor de fundo") or ("change background color") button, the background color of…
1
vote
0 answers

How do I enable autocompletion in jupyterlab?

I need to enable jupyterlab autocompletion. But when trying to install via command "pip install jupyter_contrib_nbextensions", it seems to be incompatible with Python 3.11.
1
vote
1 answer

Effect of Python 3.11 on Cython-compiled modules

I have a pure-Python module that compiles with Cython into .so, for performance. The project currently uses Python 3.8 and everything works fine. I've read CPython 3.11 comes with potentially great performance benefits, so I'm wondering the…
Mark Scott
  • 21
  • 3
1
vote
1 answer

Embed Python source code in C++ as string

I'm writing a C++ program that requires Python (3.11) code to be embedded into it and am using Python.h to try and accomplish this. The general idea is that my a python script, which will be stored by the C++ program as a string, as I'll be…
1
vote
1 answer

How to inspect ssl.SSLContext() configuration, e.g. ALPN protocols

I want to configure an SSLContext correctly. Some settings can be checked with methods, e.g. get_ciphers(). Others, such as those set by set_alpn_protocols(), don't seem to have corresponding get methods. How do I check such settings? I've tried…
1
vote
1 answer

Python: How to check what types are in defined types.UnionType?

I am using Python 3.11 and I would need to detect if an optional class attribute is type of Enum (i.e. type of a subclass of Enum). With typing.get_type_hints() I can get the type hints as a dict, but how to check if a field's type is optional Enum…
Jylpah
  • 223
  • 2
  • 7
1
vote
2 answers

Unable to upgrade Python 3.11 due to error in Locust-plugin installation (Confluent-Kafka)

After upgrading Python to 3.11, Locust-plugin fails to install as one of its dependency throws error First it asked me to install VC++ > 14.0 After installing VC++ build tools 15, still it throws a different error Note: We do not see this issue…
Naga
  • 77
  • 1
  • 6
1
vote
1 answer

How to solve "ModuleNotFoundError: No module named 'apt_pkg'" and "E: Sub-process returned an error code"

I'm on Pop-os 22.04 and I updated my default Python from 3.10 to 3.11. After updating python I'm getting this error every time I try to do "sudo apt update" $ sudo apt update **Note: Skiped first few lines, those were not errors.** Traceback (most…
1
vote
1 answer

How to get the Name of the Class a Function is in with Python 3.11

So, i have a class like this: class Test: def test69(): print(classname) and That function (test69()) prints the Name of the Class that it is in. Like, a Function is in a Class, and the Function prints the Name of the Class that it is…