After fighting with some release blockers, implementing a bunch of GC
traversal functions, and fixing some pending reference leaks, we finally
have Python 3.10.0 beta 2 ready for you! Thanks to everyone that helped to
unblock the release!
https://www.python.org/downloads/release/python-3100b2/
# This is a beta preview of Python 3.10
Python 3.10 is still in development. 3.10.0b2 is the second of four planned
beta release previews. Beta release previews are intended to give the wider
community …
[View More]the opportunity to test new features and bug fixes and to prepare
their projects to support the new feature release.
We **strongly encourage** maintainers of third-party Python projects to
**test with 3.10** during the beta phase and report issues found to [the
Python bug tracker](https://bugs.python.org/) as soon as possible. While
the release is planned to be feature complete entering the beta phase, it
is possible that features may be modified or, in rare cases, deleted up
until the start of the release candidate phase (Monday, 2021-08-02). Our
goal is to have no ABI changes after beta 4 and as few code changes as
possible after 3.10.0rc1, the first release candidate. To achieve that, it
will be **extremely important** to get as much exposure for 3.10 as
possible during the beta phase.
Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.
The next pre-release of Python 3.10 will be 3.10.0b3, currently scheduled
for Thursday, 2021-06-17.
# And now for something completely different
The Ehrenfest paradox concerns the rotation of a "rigid" disc in the theory
of relativity. In its original 1909 formulation as presented by Paul
Ehrenfest in relation to the concept of Born rigidity within special
relativity, it discusses an ideally rigid cylinder that is made to rotate
about its axis of symmetry. The radius R as seen in the laboratory frame is
always perpendicular to its motion and should therefore be equal to its
value R0 when stationary. However, the circumference (2πR) should appear
Lorentz-contracted to a smaller value than at rest. This leads to the
apparent contradiction that R = R0 and R < R0.
# We hope you enjoy those new releases!
Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.
Regards from very sunny London,
Your friendly release team,
Pablo Galindo @pablogsal
Ned Deily @nad
Steve Dower @steve.dower
[View Less]
To add to the suggestions already given in this thread I dug into code I wrote some time ago.
Offered as an inspiration.
=== missing.py ===
from typing import Any
def MISSING(klass: Any) -> Any:
"""
create a sentinel to indicate a missing instance of a class
:param klass: the class of which an instance is missing
:return: missing class object
"""
g = globals()
missing_klass_name = f"_MISSING_{klass.__module__}_{klass.__name__}_MISSING_"
if …
[View More]missing_klass_name not in g:
g[missing_klass_name] = type(
missing_klass_name,
(klass,),
{
"__repr__": lambda x: f"MISSING({klass.__name__})",
}
)
return g[missing_klass_name]()
===
and as a demo:
=== demo_missing.py ===
import pickle
from missing import MISSING
x = MISSING(str)
y = "bar"
print(f"{x!r} == {y!r}: {x == y}")
print(f"{x!r} is {y!r}: {x is y}")
# MISSING(str) == 'bar': False
# MISSING(str) is 'bar': False
with open("object.pickled", "wb") as f:
pickle.dump(x, f)
with open("object.pickled", "rb") as f:
y = pickle.load(f)
print(f"{x!r} == {y!r}: {x == y}")
print(f"{x!r} is {y!r}: {x is y}")
# MISSING(str) == MISSING(str): True
# MISSING(str) is MISSING(str): False
def foo(a: int = MISSING(int), b: int = MISSING(int)):
print(f"{a=} {isinstance(a, int)}")
print(f"{b=} {isinstance(b, int)}")
print(f"{a!r} == {b!r}: {a == b}")
print(f"{a!r} is {b!r}: {a is b}")
foo()
# a=MISSING(int) True
# b=MISSING(int) True
# MISSING(int) == MISSING(int): True
# MISSING(int) is MISSING(int): False
foo(1)
# a=1 True
# b=MISSING(int) True
# 1 == MISSING(int): False
# 1 is MISSING(int): False
class Test:
...
t = MISSING(Test)
print(f"{t=}")
# t=MISSING(Test)
===
[View Less]
Following a recent change, we now have in traceback.py:
_sentinel = object()
def print_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None,
file=None, chain=True):
So now:
>>> import traceback
>>> help(traceback.print_exception)
Help on function print_exception in module traceback:
print_exception(exc, /, value=<object object at
0x000002825DF09650>, tb=<object object at 0x000002825DF09650>,
limit=None, file=None, chain=True)
Is …
[View More]there a convention on how such default sentinel values should appear in
docs?
https://bugs.python.org/issue43024
[View Less]