Questions tagged [python-3.10]

A version of the Python programming language, first released on October 4, 2021. This tag is for issues that are specific to Python 3.10. For general questions use the more generic [python] tags.

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

782 questions
18
votes
1 answer

VS Code Python doesn't recognize match statement

When I use a match-case statement in Python in VS Code, it gives red squiggly lines and errors in the "problems" tab:
Tuor
  • 875
  • 1
  • 8
  • 32
17
votes
1 answer

Python: match/case by type of value

I came across a weird issue while using the new match/case syntax in Python3.10. The following example seems like it should work, but throws an error: values = [ 1, "hello", True ] for v in values: match type(v): case str: …
Neil Graham
  • 593
  • 1
  • 5
  • 17
13
votes
2 answers

ValueError: Exceeds the limit (4300) for integer string conversion

>>> import sys >>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default. >>> _ = int('2' * 5432) Traceback (most recent call last): ... ValueError: Exceeds the limit (4300) for integer string conversion: value has 5432…
Data Mastery
  • 1,555
  • 4
  • 18
  • 60
11
votes
5 answers

Running cells with Python 3.10 requires ipykernel installed

I just installed Python 3.10 on my laptop (Ubuntu 20.04). Running a Jupyter Notebook inside of VS Code works with Python 3.9 but not with Python 3.10. I get the error message: Running cells with 'Python 3.10.0 64 bit' requires ipykernel installed or…
10
votes
3 answers

Install Python 3.10.5 using pyenv

I want to install Python 3.10.5 (or at least Python >= 3.7.). I followed these instructions: # Step 1. Install pyenv git clone https://github.com/pyenv/pyenv.git ~/.pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export…
zest16
  • 455
  • 3
  • 7
  • 20
10
votes
2 answers

'py.test' is not recognized as the name of a cmdlet, function, script file, or operable program

Hi I am trying to run my tests using "py.test" command in the Pycharm terminal but every time is am getting this error message: py.test : The term 'py.test' is not recognized as the name of a cmdlet, function, script file, or operable program. Check…
tayyaba ishaq
  • 103
  • 1
  • 1
  • 4
10
votes
3 answers

How to do structural pattern matching in Python 3.10 with a type to match?

I am trying to match a type in Python 3.10 using the console: t = 12.0 match type(t): case int: print("int") case float: print("float") And I get this error: File "", line 2 SyntaxError: name capture 'int' makes remaining…
Pierre Thibault
  • 1,895
  • 2
  • 19
  • 22
10
votes
7 answers

PyInstaller with Python: 3.10.0b4 - ImportError: No module named _bootlocale

I have Beta 4 of Python 10 installed (which I must use because I need pattern matching feature only available in v3.10): C:\Users\myname\Documents\Projects\Project Migration\SeleniumExamplePy>py -3 --version Python 3.10.0b4 and I made sure my…
SLB
  • 101
  • 1
  • 1
  • 4
10
votes
1 answer

Avoiding accidental capture in structural pattern matching

This example is being discussed as likely "gotcha" when using pattern matching: NOT_FOUND = 400 retcode = 200 match retcode: case NOT_FOUND: print('not found') print(f'Current value of {NOT_FOUND=}') This is an example of accidental…
9
votes
3 answers

"incompatible architecture (have 'arm64', need 'x86_64')" error while installing numpy on M1 Mac with pip3 on Python Version 3.10

I was trying to install numpy version 1.22.3 on a M1 Macbook with pip3, and pip3 says the package is present, but when I try to import the module, an error gets thrown at me that says Importing the numpy C-extensions failed. This error can happen…
Lilly Pernichele
  • 91
  • 1
  • 1
  • 3
8
votes
1 answer

Formatting guidelines for type aliases

What would be the correct way to format the name of a type alias—intended to be local to its module—according to the PEP8 style guide? # mymodule.py from typing import TypeAlias mytype: TypeAlias = int def f() -> mytype: return mytype() def…
303
  • 2,417
  • 1
  • 11
  • 25
8
votes
3 answers

How to use python's Structural Pattern Matching to test built in types?

I'm trying to use SPM to determine if a certain type is an int or an str. The following code: from typing import Type def main(type_to_match: Type): match type_to_match: case str(): print("This is a String") case…
Curtwagner1984
  • 1,908
  • 4
  • 30
  • 48
8
votes
2 answers

Problems with event_loops in Python 3.10

I try to get data from the Binance Websocket. With python 3.9 as Interpreter it runs fine, but with 3.10 it gives me errors :( Here is the code: import asyncio from binance import AsyncClient, BinanceSocketManager async def main(): client =…
Max Power
  • 91
  • 1
  • 5
8
votes
3 answers

Can't install numpy on python 3.10

I'm quite new to machine learning and when I tried to install numpy and this happended Can you guys help me fix this. I'm using python 3.10.0 ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy, which…
Johnny
  • 81
  • 1
  • 1
  • 2
8
votes
4 answers

Python Structural Pattern Matching

I'm not able to run this code: match shape: case Point(x, y): ... case Rectangle(x, y, _, _): ... print(x, y) I can't find the match keyword in Python. I found it here:…
1
2
3
51 52