You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.11 is between 10-60% faster than Python 3.10. On average, we measured a 1.25x speedup on the standard benchmark suite.
Motivation
Python 3.11 is fast! And we enjoy speedup 😊!
Known issue
Change field default mutability check, allowing only defaults which are hashable instead of any object which is not an instance of dict, list or set. (Contributed by Eric V. Smith in bpo-44674.) [ref]
dataclass decorator requires nested dataclasses to use default_factory or make nested dataclasses hashable
Many test cases using mutable default will fail
get_help_text in TestSetup fail for nested dataclasses using default_factory
test_mutable_field in test_utils.py will fail due to default_factory initialize a new object for the shared A everytime.
examples using mutable default will fail in Python 3.11
simple_parsing.decorator main will need to be modified.
field_wrapper default value might be set by default_factory.
ERROR test/python311/test_dataclass.py - ValueError: mutable default <class 'test.python311.test_dataclass.A'> for field a is not allowed: use default_factory
We can pass dataclasses to the default_factory argument of field.
fromdataclassesimportdataclass, field@dataclass()classA():
arg_str: str='test'arg_int: int=1arg_float: float=0.5@dataclassclassB():
# using lambda to initialize a user specified dataclass objecta: A=field(default_factory=lambda: A(arg_str='hi'))
@dataclassclassC():
# or pass a dataclass class direct to default_factory a: A=field(default_factory=A)
deftest_dataclass():
B()
C()
Feature requested
Is your feature request related to a problem? Please describe.
Add support for Python 3.11.
Python 3.11.1 is released at Dec. 6 2022.
ref: https://www.python.org/downloads/release/python-3111/
Python 3.11 support graph for the 360 most popular Python packages! https://pyreadiness.org/3.11/
Highlight:
Motivation
Python 3.11 is fast! And we enjoy speedup 😊!
Known issue
Error Example:
output:
Passed Example:
Describe the solution you'd like
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: