Is there a reason that itertools.islice does not provide its start, stop and step values as attributes, similar to range?
This seems like a sensible and useful thing to have, and would also allow islice's to have a len.
Mathew
1 messages · Page 2 of 1
Is there a reason that itertools.islice does not provide its start, stop and step values as attributes, similar to range?
This seems like a sensible and useful thing to have, and would also allow islice's to have a len.
Mathew
We’re happy to announce the public availability of the live stream
recordings from EuroPython 2020. They were already available to all
conference attendees since the sprint days.
* EuroPython YouTube Channel *
http://europython.tv/
We have collected the videos in a EuroPython 2020 Live Stream
playlist:
https://www.youtube.com/playlist?list=PL8uoeex94UhG33fVP7GZEo06gOHlhb0hk
What we are releasing today are unedited v... continue reading
Excuse me if I am out of the loop and this is already available, but I
haven't seen it and googling is not exactly easy as numpy introduces
considerable noise.
With the introduction of the statistics module, the standard library
provides basic statistical functions that can be useful in many
scenarios, including teaching.
The math module has plenty of mathematical functions that are very
interesting, but no Matrix object. When newcomers want to have a
matrix object, they end up
implementing a l... continue reading
Many times I want a function parameter that is an iterable but not a
string. Usually I do:
try:
var.iter
except AttributeError:
# not an iterable
else:
try:
var.isascii
except AttributeError:
# put yuour code here
or
from collections.abc import Iterable
if isinstance(var, Iterable) and not isinstance(var, str):
# put yuour code here
The first example uses duck typing but it's more verbose. I use the
first method in an home-made utility function.
I... continue reading
I'd like to sound out consensus regarding mapping access, where none of the
keys are positional. In particular, I suggest that PEP 472 allow syntax and
semantics such as
>>> d[x=1, y=2] = 42
>>> d[x=1, y=2]
42
and ask whether the class
>>> X = type(d)
should be part of standard Python.
NO ARGUMENTS
At present, item access requires an argument, as a matter of syntax.
>>> d[]
SyntaxError: invalid syntax
Compare this to
>>> fn()
NameError: name 'fn' is not defined
... continue reading
Here's something that's been bugging me for years. I'll suggest something,
but since I'm a total newbie about this area, it's possible that everything
I'm saying is impossible or doesn't make sense.
I'm working with some Pandas code now, and there's an exception because I'm
doing something wrong. I get a traceback, but some of the frames are in pyd
files (C code I guess?) so I don't see the code for them.
This is frustrating, because the exception message isn't that clear, so I
would at least ... continue reading
Hello all,
I'm very happy to announce the release of pyo 1.0.1, available for python
3.6,
3.7 and 3.8.
Pyo is a Python module written in C to help real-time digital signal
processing
script creation. It provides a complete set of classes to build audio
softwares,
compose algorithmic musics or simply explore audio processing.It is
available for
Windows, macOS and linux. It is released under the LGPL 3 license.
Official website: http://ajaxsoundstudio.com/software/pyo/
pyo's do... continue reading
Dear python developers,
As a bioinformatician I work a lot with gzip-compressed data. Recently I discovered Intel's Storage Acceleration Libraries at https://github.com/intel/isa-l. These people implemented the DEFLATE and INFLATE algorithms in assembly language. As a result it is much faster than zlib.
I have posted a few benchmarks in this python bug https://bugs.python.org/issue41566. (I just discovered bugs.python.org is the wrong place for feature requests. I am sorry, I am still learning... continue reading
Hello,
I’m happy to announce the release of PyData/Sparse 0.11.0, available to download via pip and conda-forge. PyData/Sparse is a library that provides sparse N-dimensional arrays for the PyData ecosystem.
The official website and documentation is available at: https://sparse.pydata.org
The sources and bug tracker: https://github.com/pydata/sparse
The changelog for this release can be viewed at: https://sparse.pydata.org/en/0.11.0/changelog.html
Best Regards,
Hameer Abbasi
--
... continue reading
Wing 7.2.4 introduces support for Python 3.9, adds a preference to set
the size of white space indicators, and makes a number of usability
improvements.
Details: https://wingware.com/news/2020-08-17
Downloads:
https://wingware.com/downloads/wing-pro/7.2/binarieshttps://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing... continue reading
Vulture finds unused code in Python programs. This is useful for
cleaning up and finding errors in large code bases. If you run Vulture
on both your library and test suite you can find untested code.
Due to Python's dynamic nature, static code analyzers like Vulture are
likely to miss some dead code. Also, code that is only called
implicitly may be reported as unused. Nonetheless, Vulture can be a
very helpful tool for higher code quality.
Do... continue reading
I’m thrilled to finally present attrs 20.1.0 with the following changes:
JUST KIDDING!
This release is HUGE and I'm stoked we can finally get it to you! It’s the result of more than a year of development and not only does it come with many great features that users desired for a long time, it also lays the foundation for the future evolution of this package.
The final push has only been possible thanks to attrs’s Tidelift subscribers (https://tide... continue reading
I really like pathlib.
But for a while is was painful to use, 'cause there was som much code that
still used strings for paths. That was made a lot better when we introduced
the fspath protocol, and then updated the standard library to use it
(everywhere?).
But there are still a few that bug me. For instance:
file is a path represented as a string. It's not too big a deal to wrap
it in Path(), but it still annoys me.
So: would it be entirely too disruptive to replace these kinds of t... continue reading
If a file named "tkinter.py" is created and tkinter is imported and used within the file, the following exception is raised:
"AttributeError: partially initialized module 'tkinter' has no attribute 'Tk' (most likely due to a circular import)"
I've spoken to multiple beginners who got stuck on this and just couldn't figure out what was happening. Just like the error message tells us, it's due to a "circular import". In other words, we're trying to import the very file that is doing the import. T... continue reading
On behalf of the Python development community, I'm pleased to finally
announce the availability of Python 3.5.10rc1.
Python 3.5 is in "security fixes only" mode. This new version only
contains security fixes, not conventional bug fixes, and it is a
source-only release.
Important Notice: The latest releases of Linux (Ubuntu 20.04, Fedora 32)
ship with a new version of OpenSSL. New versions of OpenSSL often
include upgraded configuration requirements to maintain network
secur... continue reading
Hi Everyone,
I really like how go parses durations:
hours, _ := time.ParseDuration("10h")
complex, _ := time.ParseDuration("1h10m10s")
micro, _ := time.ParseDuration("1µs")
// The package also accepts the incorrect but common prefix u for micro.
micro2, _ := time.ParseDuration("1us")
Consider the example in https://docs.python.org/3/library/datetime.html#timedelta-objects:
>>> from datetime import timedelta
>>> delta = timedelta(
... days=50,
... seconds=27,
... ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/PJDKOK2CWNKO74PBHROH5ZSHMOQKBPXG/)
I wanted to know if there could be TypeError when giving wrong type for arguments in functions
(This usually happens when using other module's function)
e.g:
def sum(nom1: int, nom2: int):
nom = nom1 + nom2
return nom
print(sum('hello',2))
if you run this code you will get TypeError for line 2 because 'you can only concatenate str (not "int") to str'
But what am i saying is can it raise TypeError for line 4 because I gave 'hello' as nom1 and nom1 should be int
Now if I want to chec... continue reading
I wanted to know if there could be TypeError when giving wrong type for arguments in functions
(This usually happens when using other module's function)
e.g:
def sum(nom1: int, nom2: int):
nom = nom1 + nom2
return nom
print(sum('hello',2))
if you run this code you will get TypeError for line 2 because 'you can only concatenate str (not "int") to str'
But what am i saying is can it raise TypeError for line 4 because I gave 'hello' as nom1 and nom1 should be int
Now if I want to chec... continue reading
In CPython we have reference counting. My question is can we optimize current RC using strategies like Deferred RC and Coalescing? If no then where would I face problem if I try to implement these sorts of strategies?
These strategies all depend on the concept that we don't need the exact value of reference count all the time. So far in my observation, we only need exact value before running a cycle collector. If we can manage to make sure that we have exact value before entering the cycle co... continue reading
I think it is worth directly discussing the availability of slices in PEP
472-style keyword indices, since we seem to have mostly converged on a
dunder method signature. This is an issue that has been alluded to
regarding keyword-based (labelled) indices but not directly addressed. The
basic syntax would be something like d[x=1:3].
I am strongly in favor of having slices. The main motivating factor for
me, labelled dimensions in xarray, would be much, much less useful without
support for sli... continue reading
The standard library module http.server already has 2 request handlers,
with SimpleHTTPRequestHandler and CGIHTTPRequestHandler, the first serves
files from a directory, and the second executes CGI scripts.
Two new handlers could be included in the standard library :
Dear Python-ideas,
After looking at the logging module, I slammed my fist on my desk and
declared "There has to be a better way!" (
https://www.youtube.com/watch?v=wf-BqAjZb8M). Can we make the logging
module more "Pythonic" per Raymond Hettinger's presentation "Beyond PEP 8
-- Best practices for beautiful intelligible code - PyCon 2015"?
Thank you,
Adam Hendry
Version 0.1.6 of Sarge, a cross-platform library which wraps the subprocess
module in the standard library, has been released.
Fixed #44: Added an optional timeout to Command.wait() and Pipeline.wait(), which
only takes effect on Python >= 3.3.
Fixed #47: Added the replace_env keyword argument which allows a complete
replacement for os.environ to be passed.
Fixed #51: Improved error handling around a Popen call.
What does Sarge do?
-------------... continue reading
I have a proposal for an addition to the dataclasses module that I think would make it
easier to use private and name mangled variables. One of the benefits of the dataclass
decorator is that it helps lessen the amount of code when you just need a simple
constructor. A common pattern in python that isn't addressed by the current
implementation is the pattern
class MyClass:
def __init__(self, a: str, b: str):
self._a = a
self.__b = b
right now the only straigh... continue reading
Hello all,
I have a suggestion/idea for the Python standard (and/or a CPython
implementation detail, considering its memory impact): having sets behave
similar to dictionaries in that they preserve first-appearance order (i.e.
dictionaries are ordered by key which was first inserted).
As is said in the Python standard, a 'set' is by definition unordered. Yet,
internally they must be stored in some order, and when iterated upon,
converted to string, etc, some ordering must be used. Right now, i... continue reading
consider the following function:
def foo(a,b,c,x):
pass
The following calls are equivalent:
foo(1,2,3, x=0)
foo(*(1,2,3), x=0)
However, since python allows keyword arguments before star-unpacking, you
can also do:
foo(x=0, *(1, 2, 3))
But removing the unpacking, would result in a syntax error:
foo(x=0, 1, 2, 3)
This is against the understanding of unpacking, is this intentional?
Julia's burgeoning popularity has renewed my interest in dynamic dispatch.
It seems to me that many methods that have been written as a giant switch
on types can more clearly be written using dynamic dispatch. It was
prettty exciting to see that Python already has single dispatch built in,
and that it supports type annotations!
Would it be possible and desirable to extend it slightly to support Union
types?
In [1]: from functools import singledispatch
In [3]: from typing import An... continue reading
SUMMARY
Sequences and mappings are both similar and different. Let's introduce and
use a new dunder attribute, to give item access appropriate behaviour. This
proposal is based on an earlier thread - see Acknowledgments for URL.
INTRODUCTION
In Python, there are two sorts of builtin objects that have item access.
They are mappings and sequences. They have different abstract base classes.
Mappings and sequences have fundamental similarities, and also fundamental
differences.
To see an example o... continue reading
One suggestion I had for the next Python release is to add type-implication support. Many developers have learned Python, but do not want to use it since it is slow. An awesome way to fix this is to have optional type-implications. For example, if you know for sure that variable x is an int, you can make Python just a bit smaller by somehow specifying to the interpreter that the variable is an integer. Something like 'x::int = 5'. By having optional type implications, you can still do everything... continue reading
PyCA cryptography 3.1 has been released to PyPI. cryptography includes both
high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, asymmetric algorithms, message
digests, X509, key derivation functions, and much more. We support Python
2.7, Python 3.5+, and PyPy.
Changelog (https://cryptography.io/en/latest/changelog/#v3-1):
It occurs to me that there are many situations where files are human authored and can include comments but by default when python reads/modifies/writes those files by default the comments are lost.
Some examples include configfile, json and even python itself with the special case that docstrings are read without being discarded.
If we wish to generate a commented file, (such as an initial version of a config file), then file type specific code is needed but in general if we read in a file the... continue reading
Hello all,
I'm very happy to announce the release of pyo 1.0.3, available for python 3.6,
3.7 and 3.8.
Pyo is a Python module written in C to help real-time digital signal processing
script creation. It provides a complete set of classes to build audio softwares,
compose algorithmic musics or simply explore audio processing.It is
available for
Windows, macOS and linux. It is released under the LGPL 3 license.
Official website: http://ajaxsoundstudio.com/software/pyo/
pyo's documentation: htt... continue reading
All libraries related wheezy.webhttps://github.com/akornatskyy/wheezy.web and wheezy.templatehttps://github.com/akornatskyy/wheezy.template have been recently migrated from bitbucket to githubhttps://github.com/akornatskyy.
As a part of this migration there have been provided the following major benefits:
I'd like to propose adding argmax and argmin functions to the python list.
These functions return the index of a maximum / minimum element of the
list. Eg:
a = [1, 4, 2, 3]
print(a.argmax()) # 1
print(a.argmin()) # 0
It's a very popular request (based on stackoverflow
https://stackoverflow.com/questions/16945518/finding-the-index-of-the-value-which-is-the-min-or-max-in-python
), and currently there is no elegant way to find it.
What do you think?
This is the third Beta release for pyspread 2.0.
This version concentrates on usability improvements.
Pyspread is a non-traditional spreadsheet that is based on and written
in the programming language Python.
The goal of pyspread is to be the most pythonic spreadsheet application.
Pyspread is free software. It is released under the GPL v3.
Project website: https://pyspread.gitlab.io/
Download page: htt... continue reading
Hello,
I’m happy to announce the release of PyData/Sparse 0.11.1, available to download via pip and conda-forge. PyData/Sparse is a library that provides sparse N-dimensional arrays for the PyData ecosystem.
This is a bugfix release, with a fix for the regression in dot for very small values.
The official website and documentation is available at: https://sparse.pydata.org (https://sparse.pydata.org/)
The sources and bug tracker: https://github.com/pydata/sparse
The changelog for th... continue reading
For those interested in the new draft of ex PEP-0472 (which has joined
the choir invisible), I opened a draft PR
https://github.com/python/peps/pull/1579
This first draft contains only the revisited motivation and
background. I'll add the technical decisions etc in the upcoming
nights.
--
Kind regards,
Stefano Borini
What is cx_Oracle?
cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.
Where do I get it?
https://oracle.github.io/python-cx_Oracle
The easiest method to install/upgrade cx_Oracle is via pip as in
python -m pip install cx_Oracle --upgrade
What's new?
See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/lates... continue reading
Hello list!
I've been teaching programming with Python at various levels for the last 15 years. Over time, the exercises, examples, algorithmic patterns I accumulated for these courses became so numerous that I started to have trouble finding my way around: which ones to present in which course, in which order, at which time, and with which expected benefits?
I developed a tool to help me answer these questions, and more generally to rethink the structure and content of my curriculum. After a ... continue reading
Hello list!
I've been teaching programming with Python at various levels for the last 15 years. Over time, the exercises, examples, algorithmic patterns I accumulated for these courses became so numerous that I started to have trouble finding my way around: which ones to present in which course, in which order, at which time, and with which expected benefits?
I developed a tool to help me answer these questions, and more generally to rethink the structure and content of my curriculum. After a ... continue reading
This is slightly revised version of something I sent to Stefano two
weeks ago. I hope he is planning to use this, or something similar, in
the PEP, but for what it's worth here it is for discussion.
This is, as far as I can tell, the minimum language change needed to
support keywords in subscripts, and it will support all the desired
use-cases.
(1) An empty subscript is still illegal, regardless of context.
obj[] # SyntaxError
(2) A single subscript remains a single argum... continue reading
I am glad to announce the release of MySimpleGUI version 1.1,6:
GitHub https://github.com/salabim/MySimpleGUIsalabim/MySimpleGUI
https://github.com/salabim/MySimpleGUI
Enhancement for PySimpleGUI as an addon module. Contribute to
salabim/MySimpleGUI development by creating an account on GitHub.
MySimpleGUI is an extension to the popular PySimpleGUI (see
https://github.com/PySimpleGUI/PySimpleGUI) package, which adds
functionality and significantly changes exception handling, maki... continue reading
Rus:
"Также любителям бухгалтерии тоже Decimal просто необходим.
Я вот думаю Гвидо(создателю питона) надо ввести обозначение для
децималов например 'D'.А то вот float есть x = 0.012f, а для децималов
было бы удобно x = 0.012D или x = 0.012d...Причем если в выражении
есть децимал то все float int double в программе подтягиваются до Decimal то есть
x = 0.012f + 0.3D ... float 0.012f становится decimal, и х = сумме 2х децималов.
"
DeepL translate:
"Also lovers of accounting, too, Decimal just need.... continue reading
I may be in the minority, but sometimes it seems like having to spin up a venv, etc. to run a small script could be a little bit much.
What if we have something like this POC I wrote: https://pypi.org/project/pyensure/
We could have a switch or python interpreter argument to have packages get auto-installed (to a temp directory) in the event that we don't have it installed in the current environment.
One of the beauties of this is that it doesn't pollute the current environment, since packa... continue reading
Only objects of globally defined classes are picklable:
class Global:
pass
picklable = Global()
def f():
class Local:
pass
return Local
Local_here = f()
unpicklable = Local_here()
However, instances become picklable if we assign the local class to some
globally reachable identifier.
Local_here.__qualname__ = 'Local_here'
now_picklable = Local_here()
Why not make it a feature? Let's define module level global id... continue reading
The next release of kwkey will provide a class A with the following
property.
It is that
>>> A(1, 2, a=3, b=4)[d] = 'val'
will result in
>>> d.setitem((1, 2), 'val', a=3, b=4)
This is precisely the same call that would result from
>>> d[1, 2, a=3, b=4] = 'val'
using the semantics that Guido currently favours.
Further, to better support exploration, the call instead will be
d.A_setitem_((1, 2), 'val', a=3, b=4)
when d.A_setitem_ exists. (And of course similar behavio... continue reading
Dear list,
log records in the Python logging library always use timestamps provided
by time.time(), i.e. the usual system clock (UTC, CLOCK_REALTIME).
This time is used as absolute timestamp in log records and for
timestamps relative to the load of the library (Lib/logging/init.py:
_startTime).
I would like to receive feedback to and propose the attached (and
possibly incomplete) patch that allows the programmer to provide a
custom callable to get the time instead of time.time().
Fo... continue reading
Hi everyone,
We are pleased to announce Naomi Ceder as the first Keynote Speaker of
PyCon India 2020.
Naomi Ceder earned a Ph.D in Classics several decades ago but switched
from ancient human languages to computer languages sometime in the
last century. Since 2001, she has been learning, teaching, writing
about, and using Python.
An elected fellow of the Python Software Foundation, Naomi is the
immediate past chair of its board of directors. She also speaks
internation... continue reading
I am positing that Python should contain a constant (similar to True,
False, None), called Infinity.
It would be equivalent to float('inf'), i.e. a floating point value
representing a non-fininte value. It would be the positive constant;
negative infinity could retrieved via -Infinity
Or, to keep float representation the same, the name inf could be used,
but that does not fit Python's normal choice for such identifiers (but
indeed, this is what C uses which is the desired behavior of str... continue reading
On behalf of the Python development community, I'm plesed to announce
the availability of Python 3.5.10.
Python 3.5 is in "security fixes only" mode. This new version only
contains security fixes, not conventional bug fixes, and it is a
source-only release.
Important Notice: The latest releases of Linux (Ubuntu 20.04, Fedora 32)
ship with a new version of OpenSSL. New versions of OpenSSL often
include upgraded configuration requirements to maintain network
security; this ne... continue reading
Hi everyone,
PyCon India 2020 edition would be happening online and of the biggest
challenges the team faced was finding the platform which suits our
needs. We've looked through a lot of conference tools, ideas, and way
to make the event an amazing one. The main goal in front of us to make
the event as interactive as possible and as close to the offline
version as possible
The team after much review and thought has decided to go with the
platform, Hopin[1]
Hopin is an all-in-one v... continue reading
Hi everyone,
The CFP Working Group (WG) did a great job of reaching out to speakers
and achieving a good number of talk proposals. The Review Panel WG
volunteers worked parallelly to get the proposals as complete as
possible as per the guidelines we built before the Subject Matter
Expert (SME) aka Talk Reviewers started the process. Thanks to the
whole Reviewers team for putting their thought and effort into each
talk.
As of today, based on the reviews of the proposal... continue reading
PyDev 8.0 Release Highlights
MyPy
Debugger (updated to pydevd 2.0.0)
Dear python enthusiasts,
--(you can skip this part if you're in a hurry)--
4 years ago I was discovering this great language. Already an experienced software developer and data scientist at that time, accustomed with both low-level (C++), Object-Oriented (Java), Query (T-SQL), and Script (MATLAB) languages, I still have to admit that I was blown away by the capabilities and expressiveness of python !
Our team leveraged python during this period to develop our second cloud-based Analytics as a... continue reading
Hi everyone,
I’m happy to (somewhat belatedly) announce the release of attrs 20.2.0.
attrs is the direct ancestor of dataclasses in the standard library and remains the most powerful option for creating regular classes without getting bogged down with writing identical boilerplate again and again: https://www.attrs.org/
Heartfelt thanks to my generous sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-attrs, and people ... continue reading
Hi everyone,
We are pleased to announce Alolita Sharma as the second Keynote
Speaker of PyCon India 2020.
Alolita Sharma is a Principal Technologist at Amazon Web Services. She
leads open source strategy and engineering for projects focused on
observability and search including OpenTelemetry, Prometheus, Grafana,
Apache Lucene and Open Distro for Elasticsearch. Two decades of doing
open source continue to inspire her. Alolita has built and led
engineering teams at ... continue reading
Python 3.8.6rc1 is the release candidate of the sixth maintenance release of Python 3.8. Go get it here:
https://www.python.org/downloads/release/python-386rc1/ https://www.python.org/downloads/release/python-386rc1/
Assuming no critical problems are found prior to 2020-09-21, the scheduled release date for 3.8.6, no code changes are planned between this release candidate and the final release.
That being said, please keep in mind that this is a pre-release and as such its main purpos... continue reading
Dear Pythonistas and Solar Energy enthusiasts,
I am very happy to announce a new, major release of pvlib python, for
simulating the performance of photovoltaic solar energy systems.
See what's new for v0.8.0:
Releases are available from the CheeseShop and the conda-forge channel:
Read the Documentation:
This is a maintenance release to better support recent versions of Python
(3.8 and 3.9). Also, and due to the evolution of modern CPUs,
the number of default threads has been raised to 8 (from 4).
Finally, zero-copy decompression is now supported by allowing bytes-like
input. Thanks to Lehman Garrison.
For more info, you can have a look at the release notes in:
... continue reading
Hi,
Got the argparse() in version 3.8.2 and above the action=CusotmClass can have a user defined custom subclass and override the functionality in the def init() method. Along with this can we also have a built in custom method/methods that I can define under this custom Class, so that instead of calling the Action itself I have the option of calling the Action.Method() during the add_argument defintition.
Regards
Ranga
Hi everyone,
We are happy to announce S Anand as the fourth Keynote speaker of
PyCon India 2020.
Anand is the co-founder of Gramener, a data science company. He is
recognized as one of India's top 10 data scientists. He leads a team
that automates insights from data and narrates these as visual data
stories.
You can find him on Twitter: @sanand0
Please retweet the announcement to reach to all the interested parties
https://twitter.com/pyconindia/status/130402025227184... continue reading
Hi everyone,
We are pleased to announce James Powell as the third Keynote Speaker
of PyCon India 2020.
James Powell is a professional Python programmer and enthusiast. He
started working with Python in the finance industry building reporting
and analysis systems for prop trading front offices. He currently
works as a consultant building data engineering and scientific
computing platforms for a wide-range of clients using cutting-edge
open source tools like Python and R... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce that NumPy 1.19.2 has
been released. This release fixes several bugs, prepares for the upcoming
Cython 3.x release. and pins setuptools to keep distutils working while
upstream modifications are ongoing. The aarch64 wheels are built with the
latest manylinux2014 release
that fixes the problem of differing page sizes used by different Linux
distros.
There is a known problem with Windows 10 version=2004 and OpenBLAS svd that
... continue reading
Wing 7.2.5 enhances the accuracy of some types of code warnings,
improves Debug I/O process management, streamlines new virtualenv
creation, implements vi mode :[range]y, and makes a number of usability
improvements.
Details: https://wingware.com/news/2020-09-09
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing... continue reading
Hello Folks,
We are happy to announce Victor Stinner as a Fifth Keynote speaker for
PyCon India 2020.
Victor Stinner is a Python core developer for 9 years. He is paid by
Red Hat to maintain Python upstream (python.org) and downstream (RHEL,
Fedora). Author of pyperf, faulthandler and tracemalloc modules, he is
working on Python performance, security, and stability (member of the
Night's Watch, maintain Python CIs: Travis CI, AppVeyor, and the large
fleet of bu... continue reading
Hi All,
This is the first time I'm posting to this mailing group, so forgive me if I'm making any mistakes.
So one of the most common ways to load json, is via a file. This is used extensively in data science and the lines. We often write something like :-
with open(filename.json, "r") as f:
my_dict = json.load(f)
or
my_dict = json.load(open("filename.json", "r"))
Since this is sooooo common, why doesn't python have something like :-
json.loadf("filename.json")
Is there an obvious is... continue reading
This question is to further my understanding of the internals. It seems to me that a classmethod can do everything a staticmethod can, and additionally is not limited by inheritance.
Why does python have them as two different constructs?
pytest 6.0.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
I'm happy to announce the release of Pygments 2.7. Pygments is a
generic syntax highlighter written in Python.
Pygments 2.7 is an absolutely massive release, with a dozen new
languages added and over 50 pull requests merged in total -- a big thank
you to our many new first-time contributors. Please have a look at the
changelog https://pygments.org/docs/changelog/.
Report bugs and feature requests in the issue tracker:
https://github.com/pygments/pygments/issues. Thanks go to all the
cont... continue reading
Hi everyone,
The PyCon India 2020 talk schedule is out![0]
The sheer amount of proposals we received from you all over the last
couple of days exceeded all our wildest expectations. The review
committee along with all the volunteers worked quite hard to make the
deadlines work. The schedule has been released a day before the
deadline which signals us that we are on track as we move forward
according to the plan. All these efforts go on to accomplish one
outcome. An awesome PyCon India keeping ... continue reading
We’re happy to release the first 30 cut videos of EuroPython 2020. You
can watch them on our YouTube channel http://europython.tv/:
* EuroPython 2020 Playlist *
https://www.youtube.com/playlist?list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW
Over the next few days/weeks, we’ll keep releasing more videos in
batches. We are working on over 130 videos in total, so please stop by
and check the playlist for more videos, or subscribe to our YouTube
channel.
Help spread the word
------... continue reading
Python 3.9.0 is almost ready. This release, 3.9.0rc2, is the last planned preview before the final release of Python 3.9.0 on 2020-10-05. Get it here:
https://www.python.org/downloads/release/python-390rc2/ https://www.python.org/downloads/release/python-390rc2/
In the mean time, we strongly encourage maintainers of third-party Python projects to prepare their projects for 3.9 compatibility during this phase. As always, report any issues to the Python bug tracker https://bugs.python.org/... continue reading
TL;DR: I propose the following behavior:
>>> s = "She turned me into a newt."
>>> f"She turned me into a {animal}." = s
>>> animal
'newt'
>>> f"A {animal}?" = s
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
f"A {animal}?" = s
ValueError: f-string assignment target does not match 'She turned me into a newt.'
>>> f"{hh:d}:{mm:d}:{ss:d}" = "11:59:59"
>>> hh, mm, ss
(11, 59, 59)
=== Rationale ===
Part of the re... continue reading
A lot of libraries use string for attribute names to do some "dynamic" things. A typical example are SQLAlchemy validators:
from sqlalchemy.orm import validates
class EmailAddress(Base):
__tablename__ = 'address'
id = Column(Integer, primary_key=True)
email = Column(String)
@validates('email') # Here
def validate_email(self, key, address):
assert '@' in address
retu... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/UMPALRK3E2BL525V4C6KTTN5QV2NW3JY/)
Note: this suggestion should echo https://mail.python.org/archives/list/python-ideas@python.org/thread/UUFFAI3FZMQRVPDCUPZEOAZCRNXKWFDE/ but has a bigger scope and completely differs in the way to proceed.
Currently, Python lacks a way to integrate code parts into string; when I say code, I don't talk only about identifiers (on which is focusing nameof suggestion) but also about expression.
Actually, this feature exists in Python but is hidden in a 3.8 [f-string feature](https://docs.python.... continue reading
Hello,
I’m happy to announce the release of pymssql 2.1.5, available to download
via pip and GitHub. Pymssql is a simple database interface for Python
that builds on top of FreeTDS to provide a Python DB-API (PEP-249)
interface to Microsoft SQL Server.
This is primary a Python3 compatibility release, with minor fixes in
bindings to FreeTDS and test suite. The release highlights are:
In short, the idea is simple to add a special variable, available in the global scope, so you can do this:
if typing:
import typing
import another_heavy_typing_lib
It has similar semantics as typing.TYPE_CHECKING, but it would be available in any context without the need to import anything, just like name, package or loader.
By default, it would be false (like False ou None). When running static checkers and related tools it would be a true value.
Additionally, It wou... continue reading
I would like to do evil and nasty things with my dataclasses: inherit and extend them. In particular, I want to allow non-defaulted fields (ie required parameters to __init__) to be specified after defaulted fields (ie optional parameters), specifically in sub-classes (both parent and children are usable dataclasses). This is simply to reduce re-definition of fields between similar types (I wasn't able to come up with an elegant design using composition for my use-case).
The technical problem... continue reading
The current grammar for decorators is
decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE
This restricts the decorator syntax to dotted names with an optional call
with an argument list:
@spam.eggsdef f():
...
@ham('foo, 'bar')def g():
...
I love the amount of generality and abstraction in Python, but I think this
is a place where there could be more of that: I think arbitrary expressions
should be allowed; the value of that expression is what gets used as the
deco... continue reading
Greeting lists,
I am thinking of proposing to name accepted PEPs as PAPs
namely: Python Accepted Proposals.
Hence if we say PAP8 we know it's an accepted proposal.
Backstory:
I quoted V. Stinner in this
https://dev.to/abdurrahmaanj/the-zen-of-python-as-related-by-masters-1p9i
for PEP 608 https://www.python.org/dev/peps/pep-0608/, he told me
by the way it was not accepted. This got me thinking that to know
accepted peps on reading or hearing of it without seeing the status,
you need to be... continue reading
Hello everyone,
We have many compression algorithms as standard modules, but we lack two important new algorithms: brotli and zstandard.
Brotli is an important compression algorithm both for HTTP2 and for compressing/decompressing HTTP responses.
ZStandard is another algorithm for compression that can easily beat gzip with a better compression ratio and less compression time.
Both are now stable enough and are past the 1.0 mark.
Let's include them in the standard library and, of course, make ... continue reading
PEP for support for indexing with keyword arguments is now submitted as PR.
https://github.com/python/peps/pull/1612
Thanks to everybody involved in the development of the PEP and the
interesting discussion. All your contributions have been received and
often added to the document.
If the PEP is approved, I would like to attempt an implementation, but
I am not particularly skilled in the python internals. If a core
developer is willing to teach me the ropes (especially in the new
parser, I bar... continue reading
Dear Community,
we want to try a new experiment and run an “Ask me Anything” (AMA) this
Thursday to answer questions you may have, share our knowledge or help
you in planning your online event.
Some of the topics we can cover:
PyCA cryptography 3.1.1 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to
common cryptographic algorithms such as symmetric ciphers,
asymmetric algorithms, message digests, X509, key derivation functions, and
much more. We support Python 2.7, Python 3.5+, and PyPy.
Changelog (https://cryptography.io/en/latest/changelog/#v3-1-1):
-Paul Kehrer (reaperhul... continue reading
Hi Folks,
New Pythran release, tagged on github, available on PyPI and conda, and
described here:
http://serge-sans-paille.github.io/pythran-stories/pythran-097-memes-tra.html
Enjoy!
Python 3.8.6 is the sixth maintenance release of Python 3.8. Go get it here:
https://www.python.org/downloads/release/python-386/ https://www.python.org/downloads/release/python-386/
Maintenance releases for the 3.8 series will continue at regular bi-monthly intervals, with 3.8.7 planned for mid-November 2020.
What’s new?
The Python 3.8 series is the newest feature release of the Python language, and it contains many new features and optimizations. See the “What’s New in Python 3.8... continue reading
Hi,
I was wondering if the following idea would be a useful addition to the
Python language and if it could use a new PEP.
I personally find myself often looking into the documentation &
implementation of libraries I use to try and figure out what exceptions
a function may raise.
In the same vein as adding type annotations to code, I think it'd be
very useful to have exception "raises" annotations, i.e. a way to
annotate what exceptions a function raises. Again, like type
annotations, it shoul... continue reading
Hey all, I recently ran into some trouble and that I think deserves some
attention. Consider the following case:
class A(ABC):
@abstractmethod
def __lt__(self, other):
pass
@dataclass(order=True)
class B(A):
x: int = 0
class C(B):
pass
Although B technically implements A's abstract methods, it is still
considered an abstract class, and calling B() will fail. However, C is
considered a non-abstract class and calling C() will succeed.... continue reading
If you are upgrading a maintenance version (following the major.minor.maintenance naming) of python, e.g. 3.8.5 -> 3.8.6 it is also a good idea to update any 3.8 venvs that you may be using. The venv –upgrade flag is reasonably new and I think that relatively few people will have heard about it.
I was wondering if it might not be a good idea to issue a reminder, at the end of installation &/or mention reasonably prominently in the release notes, that it is a good idea to upgrade any venvs of th... continue reading
That I hope it's not the place where this proposal will be sent.
My idea is apparently simple: what if, anytime we create an object,
instead of deleting it, we send it in a trash bin? If the object is,
for some reason, recreated, we can take it from the trash bin. If
there is no more memory, the trash bin will be empty.
The problem is that, probably, args and kwargs used by object creation
must be stored. Maybe also copied? This could slow down the object
creation instead of speed it up? Could... continue reading
The pytest team is proud to announce the 6.1.0 release!
This release contains new features, improvements, bug fixes, and breaking changes, so users
are encouraged to take a look at the CHANGELOG carefully:
https://docs.pytest.org/en/stable/changelog.html
For complete documentation, please visit:
https://docs.pytest.org/en/stable/
As usual, you can upgrade from PyPI via:
pip install -U pytest
Thanks to all of the contributors to this release:
None of the examples posted in use cases show combinations of position and
keyword indexing. This feels like an important example, and moreover
without it, the discussion of what sentinel to use is less motivated.
In discussions, I have mentioned two examples, e.g.
distances[4:7, 100:120, 30:40, unit="metres"]
Which could make comparisons of arrays with different internal units easier.
disributed_array[4:7, 100:120, 30:40, source="worker1"]
Which works be a natural way to address da... continue reading
The error message for using a mutable sequence as a set item or map key
seems to frequently confuse Python beginners. The current wording is:
{[1, 2, 3]: [4, 5, 6]}
TypeError: unhashable type: 'list'
The first thing a Google search finds for "unhashable type" is ~4k Stack
Overflow results like:
https://stackoverflow.com/questions/13264511/typeerror-unhashable-type-dict
The message does not include:
Hi Everyone,
I would like to propose an idea for the regular expression module re.search(Pattern, Input) to support List[str] input type.
So it will return a matched object list if the input is a string list. Otherwise, it will return a normal matched object, if the input is a normal string
Best Regards
Giang
I am pleased to announce the release of SfePy 2020.3.
SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.
Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy
... continue reading
I'm pleased to announce v0.0.2 of my kwkeys package.
https://pypi.org/project/kwkey/
The main new feature is items-key duality. Based on that, it emulates the
semantics proposed by D'Aprano and van Rossum. It also emulates the
semantics proposed by myself.
What does this mean? Here, by duality I mean treating
items[key]
key[items]
as roughly equivalent. This allows us to move the keyword arguments outside
the square brackets.
In other words, the following
items[1, 2, a=3, b=4] = v... continue reading
Hi, My name is Jonatan and i am programming in Python for about 4 years,
I have a great idea, there are iX` methods, such as ior, iadd,
iand etc.., which implements the |=, +=, &= behavior,
it would be nice if you could implement also igetattr or something,
which means:
instead of
con = "some text here"
con = con.replace("here", "there")
we could do
con = "some text here"
con .= replace("here", "there")
Please let me know what do you think about it, Jonatan
Hello!
I'm pleased to announce version 3.8.1, the first bugfix release of branch
3.8 of SQLObject.
The contributor for this release is Neil Muller.
PyGreSQL version for Python 3.4.For a more complete list, please see the news:
http://sqlobject.org/News.html
What is SQLObject
==============... continue reading
NestedText is a file format for holding data that is to be entered, edited, or viewed by people. It allows data to be organized into a nested collection of dictionaries, lists, and strings. Similar to YAML, but much simpler. It pairs nicely with voluptuous to create a simple and powerful solution for configuration files.
NestedText is a nice alternative to JSON, YAML, and TOML.
Documentation: https://nestedtext.org
Install: pip inst... continue reading
Hi all,
I've been working in q and k, which is where this idea comes from.
My idea is to make lists and dicts callable, with call =
getitem.
So that:
3,4,5 gives 4
{'a':1, 'b': 2}('b') gives 2
Arguably a list is a function which maps from range(len(list)) to the
list entries, and a dictionary is a function that maps from keys to
values.
This would mean that functions designed to take functions, can be
repurposed to take data, for example:
map(lst, idxs) instead of (lst[i] for... continue reading
On behalf of the Python development community and the Python 3.9 release team, I’m pleased to announce the availability of Python 3.9.0.
Python 3.9.0 is the newest feature release of the Python language, and it contains many new features and optimizations. You can find Python 3.9.0 here:
https://www.python.org/downloads/release/python-390/ https://www.python.org/downloads/release/python-390/
Most third-party distributors of Python should be making 3.9.0 packages available soon.
See... continue reading
str_iterator, bytes_iterator, range_iterator, list_iterator, and tuple_iterator (and probably others) should have a method that is capable of efficiently advancing the iterator, instead of having to call next repeatedly.
I suggest adding an itertools.advance function which dispatches to a dunder advance method (if one exists) or, as a fallback, calls next repeatedly. Then, the iterators mentioned above (and any others capable of efficiently doing so) would implement advance, which would... continue reading
Hi,
Please pardon me if my idea is not making sense or already exists, I'm kind
of new to developing in Python but I had this idea today and I wanted to
share it with you.
I think a class type such as "@functionclass" may be helpful for creating
functions intended to keep a list of methods in a scope.
At the moment, I achieved this via writing "@classmethod" to all my
functions but I think such a decorator might help clarify intent for the
reader and ease the programmers' job.
My regards,
Al... continue reading
SUMMARY
This post asks for some examples that will improve PEP 637, by providing
examples where the existing language specification is not adequate (but PEP
637 is). The rest of this post should tell you why I want these examples,
and what they should look like.
DISCLAIMER
I'm an editor of PEP 637, writing in my personal capacity. And I'm also the
author of package kwkey mentioned below.
SUMMARY
PEP 637 adds to Python's syntax and semantics. It adds statements such as
x[1, 2, a=3, b=4] ... continue reading
Currently there are a few Protocols
https://docs.python.org/3/library/typing.html#protocols defined in the
typing module. One that I recently felt like was missing was a typing
annotation for classes with a str() method defined. Seems like a fairly
straightforward implementation.
@runtime_checkable
class SupportsString(Protocol): """An ABC with one abstract method
str."""
slots = ()
@abstractmethod
def str(self) -> str:
pass
Perhaps there is another way to do this that I am miss... continue reading
Hi all,
Something that's on many of our wishlists is support for variadic generics.
Here's a first draft of a PEP detailing how they might work.
https://docs.google.com/document/d/1oXWyAtnv0-pbyJud8H5wkpIk8aajbkX-leJ8JXsE318/edit
(Attached is also an HTML render of the RST for easier reading.)
This is an early draft so there are likely many things we're still missing.
Please do take a look and give us your feedback (in the doc directly or by
email, whichever is easiest for you).
Thanks!
Matt... continue reading
Hey,
python 3.9 introduced the | operator for union types. it would be nice
to have something like that for optional types. maybe like
name: ? int
or
name: int ?
best regards
Sebastian Lübke
PyScripter is a free and open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages. It is feature-rich, but also light-weight.
New features:
I was making a "convert Fraction to Decimal, exactly if possible" function and ran into a wall: it's not possible to do some of the necessary operations with exact precision in decimal:
I assume there's some way around it that I haven't spent enough time to figure out [create a temporary context with suffic... continue reading
Wing 7.2.6 improves exception reporting for pytest, implements 2w in vi
mode, fixes problems with setting up a new Django project, improves
auto-spacing for / and :, reduces CPU use when analyzing and waiting for
remote files, and makes a number of usability improvements.
Details: https://wingware.com/news/2020-10-07
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, cod... continue reading
Hello!
I want to discuss one feature for handful working with shapes of array-like objects.
If we want to pass arrays to function we can declare their sizes directly with argument declaration:
def foo(a[m, n], b[n]):
for i in range(m):
for j in range(n):
a[i, j] = b[j]
Will be equivalent to
def foo(a, b):
m, n = a.__shape__()
n_b = b.__shape__()
if n_b != n:
raise ShapeNotValidException()
...
Objects should implement `shape... continue reading
Happy to announce a project I've been working on for some time that's
finally in beta: aiosnow, a MIT licensed Python 3 client library for
interacting with an ITSM cloud service, providing something not too
dissimilar to a database ORM.
I'm sharing this here as the library makes use of Python asyncio, and other
cool features like:
I am happy to announce Guppy 3 3.1.0
Guppy 3 is a library and programming environment for Python,
currently providing in particular the Heapy subsystem, which supports
object and heap memory sizing, profiling and debugging. It also
includes a prototypical specification language, the Guppy
Specification Language (GSL), which can be used to formally specify
aspects of Python programs and generate tests and documentation from a
common source.
Guppy 3 is a fork of Guppy-PE, created by Sverker Nils... continue reading
Very often I use the following construction (especially in operators):
try:
something
except SomeError:
try:
something_else
except AnotherError:
try:
something_completely_different
except Whatever:
return NotImplemented
I propose a construction to simplify the staircase hierarchy of
exception handlers:
try:
something
except SomeError try:
something_else
... continue reading
I generally find exception objects are really just boilerplate heavy objects masking what I really want them to be, function calls:
class MySpecialException(Exception):
def init(self, some, variables, i, am, tracking):
self.some = some
...
...
try:
if some_test_that_fails(variables):
raise MySpecialException(a, b, c, d, e, f)
except MySpecialException as e:
logger.warning(f"BAD THING {e.a} HAPPENED!")
if not handle_it(e.a, e.b, e.c, e.f):
raise
...
Instead of ne... continue reading
Hi
The following is copied and pasted from
https://github.com/python/peps/pull/1650
Commit message:
PEP 637 I've asked Jonathan Fine to resign as PEP author, and he's agreed
to do so. Details in the pull request
Pull request comment:
Hi Jonathan
Thank you for accepting my invitation to be a co-author of PEP 637. I
regret that because of disagreeing direction for the PEP I think it best
for the community that I ask you to resign as co-author.
Thank you for your he... continue reading
Hi,
I would like to request a new feature that allows you to clear the console
screen.
Like in c++, the CLS function
Thanks
PEP 515 added underscore to numeric literals, it brings better readability.
PEP 515 -- Underscores in Numeric Literals
https://www.python.org/dev/peps/pep-0515/
Is it possible to add _KB, _MB, _GB to numeric literals, for example:
200_KB (200*1024)
150_MB (150*1024*1024)
2_GB (2*1024*1024*1024)
Do you think it's a good code style?
I am delighted to announce the release 2.0.0 of Austin. If you haven't
heard of Austin before, it is an open source frame stack sampler for
CPython, distributed under the GPLv3 license. It can be used to obtain
statistical profiling data out of a running Python application without a
single line of instrumentation. This means that you can start profiling a
Python application straightaway, even while it's running on a production
environment, with minimal impact on performance.
The simplest ... continue reading
Hi there,
Since Python 3.4, once can replace easily the Python memory allocators
via the C API with its own copy
(https://docs.python.org/3/c-api/memory.html#customize-memory-allocators).
This is a great feature for implementing performance optimizations or
profiling. This has given the ability to build powerful tools such as
tracemalloc!
However, there's one cruelly missing feature.
The API only gives you access to the number of bytes to allocate and
later to the pointer to free. It would b... continue reading
In the last few weeks, we had a close look at the how the situation
around COVID-19 is panning out. Unfortunately, things are not moving in
a direction where we’d feel confident to hold next year’s conference as
an in-person event in Dublin.
After discussion with the venue, we decided to postpone the in-person
conference for another year, to July 11-17 2022 in Dublin, Ireland. We
are currently finalizing the details.
Since going online has p... continue reading
Hi everyone,
For many years, I've used a cache decorator that I built
https://github.com/cool-RR/python_toolbox/blob/master/python_toolbox/caching/decorators.py#L36
for caching Python functions. Then functools.lru_cache was implemented,
which is much more standard. However, as far as I know, it holds normal
references to its keys, rather than weak references. This means that it can
cause memory leaks when it's storing items that don't have any references
elsewhere. This often makes me rel... continue reading
Hi Everyone,
When adding debug option to a program I find useful to keep
temporary stuff. tempfile.NamedTemporaryFile has option delete
defaulting to True. What about adding such option to
tempfile.TemporaryDirectory as well? It would be just a minor
modification in Lib/tempfile.py.
What do you think?
Kind regards,
David Kolovratník
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.5.3, which is a bug fix release that includes
Linux ARM64 wheels for the first time.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.5.3
One of a few ways to install this release with pip:
pip install scipy==1.5.3
SciPy... continue reading
After a nearly year-long alpha and beta phase, Webware for Python 3.0.0 has been released today.
Here are all the important links:
GitHub: https://github.com/WebwareForPython/w4py3
PyPI: https://pypi.org/project/Webware-for-Python/
Documentation: https://webwareforpython.github.io/w4py3/
List of changes: https://webwareforpython.github.io/w4py3/changes.html
Mirgration guide: https://webwareforpython.github.io/w4py3/migrate.html
The main improvements and changes in Webware for Python 3 are:
... continue reading
We’re happy to announce that all edited videos of this year’s conference
are now available on our YouTube channel:
* EuroPython 2020 Playlist *
https://www.youtube.com/watch?v=CvbQArKEFes&list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW
We have 131 videos available in total, covering a very broad set of
Python topics, so there’s going to be something interesting for
everyone.
We hope to see you all again next year and perhaps even have a few more
people attending EuroPython 202... continue reading
Hi Ideas,
I frequently find myself in the following situations:
I wish to do something if no exception is thrown, for instance:
try:
logger.debug('Fiber starting: %s', self)
try:
self._result = self._routine()
finally:
logger.debug('Fiber finished: %s', self)
except:
raise
else:
raise FiberExit(self)
finally:
self._finished.set()
unregister_fiber(self)
Here it's sufficient that that if an except... continue reading
It is common to use _ as a placeholder for variable whose value is not
used. For example:
for _ in range(n)
head, _, tail = name.partition(':')
first, *_, last = items
I though about optimizing out unnecessary assignments. Actually I wrote
a patch half year ago and tested it. It did not add much to performance,
and did not reduce the bytecode, so I ccoled down to him and put it off.
Later PEP 622 was declared the use of _ in pattern matching, so I was
waiting for what it would come... continue reading
Hey there,
This is my first letter here, I'll try my best to explain the problem.
First of all, I ran into this "problem" several times. I find
str.split() a bit confusing. First of all, this is a corner case, but
can happen like every day.
print("".split()) # returns []
print("".split(" ")) # returns ['']
print("".split("\t")) # returns ['']
print("".split("\n")) # returns ['']
print("".splitlines()) # returns []
So using split with or without a separator matters a lot, even when we ... continue reading
Hello Python Ideas,
Would there be any interest in upstreaming a patch allowing virtualenv to be inherited in core python ?
I'm working with a company that uses such an internal patch and would be ok with me spending some time trying to upstream it.
When creating a venv, this let you point to "parents" venvs that will be used to search for existing packages; thus potentially making the creation of large venvs with a common base faster, and decreasing disk space usage.
I am aware that the... continue reading
There are many ways to invoke a function from the commandline. You can
use setuptools' console_scripts entrypoint. You can use a decorator
from click. And of course you can always do the classic
if name == "main":
main()
to call whatever main() is. But there are inconveniences with these
approaches. For setuptools, you have to actually run setup, somehow.
For click, you have to install click. And for name, you are either
locked into a single function name, or you have to write so... continue reading
If not already present, do you think it's useful to add a macro that does
something like
fprintf(stderr, "%s\n", message);
?
Hi,
I have been programming in python for about 6 years now. However, I am a
newbie to this mailing list. My observation in the last couple of days is
that this is literally an explosion of ideas and in various degrees. I am
wondering if there is a common place or site where the ideas that went
beyond proposal and got heads up for implementation have been listed. Are
they consolidated somewhere to be discussed further ? Or is it something I
have to scrape through mailing list archives ?
Thanks... continue reading
Hello,
consider this snippet please
cursor.execute(f"INSERT INTO {table} VALUES (1, '{}');")
SyntaxError: f-string: empty expression not allowed
It is (absolutely) correct to insert empty json into database table field.
Empty expression in f-string should
Thank you in advance
Hans
After the pattern matching discussion died out, we discussed it with the
Steering Council. Our discussion ended fairly positive, but there were a
lot of problems with the text. We decided to abandon the old PEP 622 and
break it up into three parts:
This turned out to be more work than I had expected (basically we wrote all
new material) but we've finally made it to a point where we can request
feedback and submit ... continue reading
I would like to propose dict (or mapping) unpacking assignment. This is
inspired in part by the Python-Ideas thread "f-strings as assignment
targets", dict unpacking in function calls, and iterable unpacking
assignment.
Comments welcome.
Iterable unpacking assignment:
values = (1, 2, 3)
a, b, c = *values
is a very successful and powerful technique in Python. Likewise dict
unpacking in function calls and dict displays:
kwargs = {'a': 1, 'b': 2}
fun... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/FJYAE6P5263G3MQMVQ5IUCXUNAUJYQAT/)
SUMMARY:
I share with you extracts from a personal email Rick Teachey sent me, on my
involvement in PEP 637 (keyword arguments in item access), and my answers
to some important questions he asks.
BACKGROUND:
Last week, prior to my publicly stating my resignation as a co-author of
PEP 637, Ricky Teachey sent me a personal email. I found it so deep and
perceptive that I asked him for permission to share extracts with you on
this list. I'm pleased that he's allowed this, and I'm most grateful to h... continue reading
ACTIVITY SUMMARY (2020-10-16 - 2020-10-23)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7608 (-99)
closed 46258 (+176)
total 53866 (+77)
Open issues with patches: 3059
#2190: MozillaCookieJar ignores HttpOnly cookies
https://bugs.python.org/issue2190 reopened by terry.reedy
#25655: Python errors related to... continue reading
Hello
Can I suggest a feature to discuss and hopefully develop and send a PR. I
think having a fail keyword for unit testing would be great. So we write
a test as follows which will fail to begin with.
class MyTest(unittest.TestCase):
def test_this_and_that(self):
"""
Given inputs
When action is done
Then it should pass
"""
fail
This keyword is to fill an empty function block like pass but this will
make the function raise an exception that test is f... continue reading
Pattern-matching is great. I think PEP 634 is on the right track, but it
would be a waste to only use pattern-matching for choosing a branch in a
match statement.
Let’s look at Rust:
if let [x, y] = my_array {
...
}
Rust "if let" constructs are an alternative to full-blown match
statements that make it less verbose to match a single pattern.
We have a similar problem. The syntax proposed by PEP 634 is pretty
verbose for matching a single pattern:
match my_list:
... continue reading
Hi, all.
To avoid BytesWarning, the compiler needs to do some hack when they
need to store bytes and str constants in one dict or set.
BytesWarning has maintenance costs. It is not huge, but significant.
When can we remove it? My idea is:
3.10: Deprecate the -b option.
3.11: Make the -b option no-op. Bytes warning never emits.
3.12: Remove the -b option.
BytesWarning will be deprecated in the document, but not to be removed.
Users who want to use the -b option during 2->3 conversion need to ... continue reading
I would like to propose that Python adopts a modified process
before introducing significant changes of its syntax.
Given the following file:
# coding: experimental-syntax
from experimental-syntax import fraction_literal
from experimental-syntax import decimal_literal
assert 1 /3F == Fraction(1, 3)
assert 0.33D == Decimal('0.33')
print("simple_test.py ran successfully.")
This is what happens when I run it, with the standard Python ... continue reading
I have a use case where I'm writing a small filter in Python which
should be able to take output from the find command to filter and
optionally pass it to other commands (like xargs), but also can be
passed specific filenames for the input and/or output. Find can output
it's filenames in null-terminated lines since it is possible to have
newlines in a filename(yuck). There are workarounds that I can use to
get the same thing done, essentially using TextIOWrapper in '' mode and
scanning for any... continue reading
This is just a hack idea I had for functions/methods that have
parameters with default values, possibly outside the control of the user
of said function, where sometimes it is desired to pass an argument to
the function that differs from the default but other times it is desired
to just use the default, whatever that may be
def dosomething(count=5):
doing_something
def dosomething_twice(count=None):
# if count is none, ... continue reading
Hello all,
I'm glad to announce the release of psutil 5.7.3:
https://github.com/giampaolo/psutilHere's a blog post explaining the
highlights in detail:
https://gmpy.dev/blog/2020/freebsd-process-environ-and-resource-limits
psutil (process and system utilities) is a cross-platform library for
retrieving information on running processes and system utilization (CPU,
memory, disks, network) in Python. It is useful mainly for system
monitoring, profiling and limiting process... continue reading
Python has many tools for iteration, such as map and filter, that change an iterator into another iterator without consuming the iterator. These make it simple to deal with many items in a list without consuming excessive memory.
Occasionally it is useful to be able to tap into iterator items and execute a function (such as a side effect to validate elements or print them) without making any changes to the overall iterator. This is similar to the idea of a tap in rxjs: https://rxjs-dev.firebase... continue reading
Some code needs to maintain an output buffer that has an unpredictable size. Such as bz2/lzma/zlib modules, _PyBytesWriter/_PyUnicodeWriter.
In current code, when the output buffer grows, resizing will cause unnecessary memcpy().
issue41486 uses memory blocks to represent output buffer in bz2/lzma/zlib modules, it could eliminate the overhead of resizing.
There are benchmark charts in issue41486: https://bugs.python.org/issue41486
_PyBytesWriter/_PyUnicodeWriter could use the same way.
If ... continue reading
logassert is a simple log assertion mechanism for Python unittests.
Why? As is vox populi, you must also test the logging calls in your
programs. With logassert this is now very easy.
In this version:
Simple way to check that nothing was logged (on any level or a specific one):
assert NOTHING in logs.debug
Helper to check that several lines were logged one after the other:
assert Sequence(
"Got 1 error and \d+ warnings:",
Exact(" error: bar"),
) in logs.deb... continue reading
PyCA cryptography 3.2 has been released to PyPI. cryptography includes both
high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, asymmetric algorithms, message
digests, X509, key derivation functions, and much more. We support Python
2.7, Python 3.5+, and PyPy.
Changelog (https://cryptography.io/en/latest/changelog/):
Leo 6.3 b1, http://leoeditor.com, is now available on GitHub
https://github.com/leo-editor/leo-editor.
Leo is an IDE, outliner and PIM http://leoeditor.com/preface.html.
The highlights of Leo 6.3
Links
Salabim is a powerful discrete event simulation package in pure Python that
can be used to model transport systems, production logistics, warehousing,
communication systems, healthcare, mining, etc,
It uses a process description methodology comparable to SimPy, but offers
much more functionality: real-time animation, queue handling, monitoring of
process characteristics, advanced statistical sampling and more.
Go to www.salabim.org for details and resources.
release notes salabim 20.0.4... continue reading
The way I understand it, multiple dispatch is programming language feature
wehreby a function or method overload is chosen based on run time types.
Python already has single dispatch (functools.singledispatch). It also has
the concept of overloads for type annotations (typing.overload).
My main motivation for suggesting multiple dispatch for Python is to
simplify writing comparison operators and to facilitate mypy's ability to
understand them.
Python has a long history of writing compar... continue reading
Dear colleagues,
We are very happy to announce the v4.1 release of the Astropy package,
a core Python package for Astronomy:
Astropy is a community-driven Python package intended to contain much
of the core functionality and common tools needed for astronomy and
astrophysics. It is part of the Astropy Project, which aims to foster
an ecosystem of interoperable astronomy packages for Python.
New and improved major functionality in this release includes:
Author: Christian Heimes christian@python.org
PyCA cryptography 3.2.1 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to
common cryptographic algorithms such as symmetric ciphers,
asymmetric algorithms, message digests, X509, key derivation functions, and
much more. We support Python 2.7, Python 3.5+, and PyPy.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-2-1):
-Paul Kehrer ... continue reading
pytest 6.1.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
Hi!
The timeline for this year's election will be the same as last year.
Nominations will be collected via https://discuss.python.org/ (more details
to follow on Nov 1).
New for this year: Ernest W. Durbin III will be running the vote along with
the assistance of Joe Carey, a PSF employee. They will be co-... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce that NumPy 1.19.3 has
been released. NumPy 1.19.3 is a small maintenance release with two major
improvements:
This release supports Python 3.6-3.9 and is linked with OpenBLAS 3.12 to
avoid some of the fmod problems on Windows 10 version 2004. Microsoft is
aware of the problem and users should upgrade when th... continue reading
On behalf of the steering council, I am happy to announce that as
BDFL-Delegate I am
accepting PEP 626 -- Precise line numbers for debugging and other tools.
I am confident this PEP will result in a better experience for debuggers,
profilers and tools
that rely on tracing functions. All the existing concerns regarding
out-of-process debuggers
and profilers have been addressed by Mark in the latest version of the PEP.
The acceptance of
the PEP comes with the following requests:
Hi all,
Right now, when a debugger is active, the number of local variables can
affect the tracing speed quite a lot.
For instance, having tracing setup in a program such as the one below takes
4.64 seconds to run, yet, changing all the variables to have the same name
-- i.e.: change all assignments to a = 1 (such that there's only a single
variable in the namespace), it takes 1.47 seconds (in my machine)... the
higher the number of variables, the slower the tracing becomes.
import time... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/62WK3THUDNWZCDOMXXDZFG3O4LIOIP4W/)
Author: Ewa Jodlowska ewa@python.org, Ernest W. Durbin III ewdurbin@gmail.com, Joe Carey joe@python.org
Hi,
I propose to drop the Solaris support in Python to reduce the Python
maintenance burden:
https://bugs.python.org/issue42173
I wrote a draft PR to show how much code could be removed (around 700
lines in 65 files):
https://github.com/python/cpython/pull/23002/files
In 2016, I asked if we still wanted to maintain the Solaris support in
Python, because Solaris buildbots were failing for longer than 6
months and nobody was able to fix them. It was requested to find a
core developer vo... continue reading
https://user-images.githubusercontent.com/9541/97474395-5b9a9b80-194c-11eb-8ada-5fbe23fb37c9.png
,--.
| oo|
| ~~| o o o o o o o o o o o o o
|//|
python3 -m pip install pygame==2.0.0
What's the best feature of pygame 2? Maybe it's "backwards compatibility".
For many, many apps pygame 2 is backwards... continue reading
Hi everyone,
PEP 634/5/6 presents a possible implementation of pattern matching for
Python.
Much of the discussion around PEP 634, and PEP 622 before it, seems to
imply that PEP 634 is synonymous with pattern matching; that if you
reject PEP 634 then you are rejecting pattern matching.
That simply isn't true.
Can we discuss whether we want pattern matching in Python and
the broader semantics first, before dealing with low level details?
Do we want pattern matching in Python at all?
---... continue reading
I have installed new python version 3.9, I wanted to move all the site-packages that I have used in 3.8 to 3.9 lib. Is it possible?
I also wanted to know why we need to have lib under every specific version, it would be nice if we have common lib in which I can configure those based on the version I use. Is that available already if not is that something we can implement in future version this will help most of the developers in not moving the site-packages from one version to another ever... continue reading
We're pleased to announce the release of RISE 5.7.1!
What is RISE?
RISE lets you show your Jupyter notebook rendered as an executable
Reveal.js-based slideshow.
It is your very same notebook but in a slidy way!
For more information about this release, please visit the following blog
post: https://damianavila.github.io/blog/posts/rise-571-is-out.html
Have fun!!
--
Damián Avila
ACTIVITY SUMMARY (2020-10-23 - 2020-10-30)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7626 (+18)
closed 46322 (+64)
total 53948 (+82)
Open issues with patches: 3063
#30681: email.utils.parsedate_to_datetime() should return None when da
https://bugs.python.org/issue30681 reopened by serhiy.storchaka
#4191... continue reading
Hi folks,
This is a mailing list repost of the Discourse thread at
https://discuss.python.org/t/pep-642-constraint-pattern-syntax-for-structural-pattern-matching/5614
The rendered version of the PEP can be found here:
https://www.python.org/dev/peps/pep-0642/
The full text is also quoted in the Discourse thread.
The remainder of this email is the same introduction that I posted on Discourse.
I’m largely a fan of the Structural Pattern Matching proposal in PEP
634, but there’s one specific p... continue reading
heapq module contains all the function to implement a Heap structure,
Main functions required to implement Heap data structure are:
function heappush - to push an element in Heap
function heappop - to pop an element from Heap
for implementing Minheap this functions are present in the module as :
heappush - for adding element into Minheap
heappop - to pop an element from Minheap
for implementing Maxheap only one of this two required functions is present:
_heappop_max - to pop an element from... continue reading
Index heap is essential in efficient implementation of Dijkstra's algorithm, Prim's algorithm and other variants, I have implemented a concise version at https://github.com/yutao-li/libheap , I think it would be useful to have it in stdlib
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.19.4. NumPy 1.19.4 is a quick release to revert the OpenBLAS library
version. It was hoped that the 0.3.12 OpenBLAS version used in 1.19.3
would work around the Microsoft fmod bug, but problems in some docker
environments turned up. Instead, 1.19.4 will use the older library and run
a sanity check on import, raising an error if the problem is detected.
Microsoft is aware of the problem and has promised ... continue reading
The engines of the secret release manager machine have finished producing a
new pre-release. Go get it here:
https://www.python.org/downloads/release/python-3100a2/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This releasee, 3.10.0a2 is the second
of six planned alpha releases. Alpha releases are intended to make it
easier to test the current state of new features and bug fixes and to test
the release process. During the alpha phase, features ... continue reading
The engines of the secret release manager machine have finished producing a
new pre-release. Go get it here:
https://www.python.org/downloads/release/python-3100a2/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This releasee, 3.10.0a2 is the second
of six planned alpha releases. Alpha releases are intended to make it
easier to test the current state of new features and bug fixes and to test
the release process. During the alpha phase... continue reading
TL;DR Changes may be coming to Enum str() and repr() -- your (informed) opinion requested. :-)
Python-Dev thread [0], summary below:
As you may have noticed, Enums are starting to pop up all over the stdlib [1].
To facilitate transforming existing module constants to IntEnums there is
IntEnum._convert_. In Issue36548 [2] Serhiy modified the repr of RegexFlag:import re
re.I
re.IGNORECASEI think for converted constants that that looks nice. For a... continue reading
I have recently have the opportunity to work on a Python web application. I've found it beneficial to reduce duplicate code with the following code lines
import textwrap
from pathlib import Path
exec(textwrap.dedent(Path('myfile.py').read_text()))
Perhaps such code could be the basis for a python_include() statement similar to how includes, requires work in PHP.
Thank you for any consideration.
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.5.4, which is a bug fix release that includes
Python 3.9 wheels and a more complete fix for build issues on XCode 12.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.5.4
One of a few ways to install this release with pip:
pip install scipy==1.5.4
=====================
SciPy 1.5.4 Release Notes
=======... continue reading
Hi, all.
Since "How To" guide is not organized well, it is very tempting to
write all details in tutorial.
I have seen may pull requests which "improve" tutorial by describe
more details and make
the tutorial more perfect.
But adding more and more information into tutorial makes it slower to
learn Python by reading tutorial.
10+ years ago, Python is far less popular in Japan and reading
tutorial is the best way to learn Python to me.
But now Python is popular and there are many free/paid good... continue reading
Hi everyone,
I’m happy to announce the release of attrs 20.3.0!
attrs is the direct ancestor – and the inspiration for – dataclasses in the standard library and remains the more powerful option for creating regular classes without getting bogged down with writing identical boilerplate again and again: https://www.attrs.org/
Heartfelt thanks to my generous sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-attrs, and p... continue reading
Is there a reason, why not to make python useful for practical one liners
to replace perl and awk?
There is page Powerful Python One-Liners,
https://wiki.python.org/moin/Powerful Python One-Liners.
But almost none of them handles files, behaves like unix filter
or is ugly – must import modules, etc.
It seems that the command line options like -a, -n, -p, -F are still free. :-)
https://docs.python.org/3/using/cmdline.html
Why not use them almost the same way as in Perl?
https://perldoc.perl... continue reading
Hey Guys,
I am Manak Wadhwa. I have a good hand in python language, ML Algorithms, Web Dev (HTML5, CSS3, JS, PHP, AJAX, Bootstrap, JQuery). I want to contribute to python org can someone help as which repository should i start with or work on.
Leo 6.3, http://leoeditor.com, is now available on GitHub
https://github.com/leo-editor/leo-editor.
Leo is an IDE, outliner and PIM http://leoeditor.com/preface.html.
The highlights of Leo 6.3
Links
Apologies that this is a long email, but I want to make sure I get my
points across and it's difficult to do it in a short email. I touched on
some of these things in a blogpost I wrote (
https://pyrandom.blogspot.com/2020/11/my-view-of-python-steering-council.html)
but I wanted to make the main points in detail in a way that made it easy
for people to provide feedback if they wanted, so it's an email instead of
a blog post.
We haven't broadly announced it, but the current SC has decided not to... continue reading
ACTIVITY SUMMARY (2020-10-30 - 2020-11-06)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7617 ( -9)
closed 46397 (+75)
total 54014 (+66)
Open issues with patches: 3062
#37319: Deprecate using random.randrange() with non-integers
https://bugs.python.org/issue37319 reopened by serhiy.storchaka
#42160: unneces... continue reading
Hello,
We are using doctest to give our developers easy access to write very
fast unit tests and encourage "tests as documentation".
Recently we hit an issue where doctest crashes on certain objects that
fail to "unwrap".
Looking at the code and reasoning behind the crash it seems like we can
simply ignore a failed call to unwraps.
There is now a PR open against against trunk and 3.8 branch (happy to
make a 3.9 branch PR as well) here:
trunk: https://github.com/python/cpython/pull/22981... continue reading
Dear all,
I am the maintainer of an Italian translation of the Python Tutorial: https://pytutorial-it.readthedocs.io.
Since the Italian translation is kept in sync with the original repo (across all the branches!), from time to time I get an alert when a change is committed.
This morning I noticed this new commit, referring to bpo-42179: "Remove mention of cause" (https://bugs.python.org/issue42179). From reading this thread, it turns out that a minor confusion in the wording, about __c... continue reading
AFAICT, there is no way to filter warnings based on anything but their most immediate caller (please correct me if I'm wrong). This can lead to situations where it's impossible to write a warnings filter that's not brittle. For example:
Say I want to filter a certain warnings sphinx.ext.autodoc during my build process (e.g. to ignore deprecation warnings when autodoc imports deprecated modules that I need to keep documented). I can filter:
warnings.filterwarnings('ignore', category... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/IT7YPI44OH3LRV7OVV632WLWI566PW7Q/)
Hi folks,
I have updated PEP 642 significantly based on the feedback received
over the past week.
Since the Discourse thread hadn't received any comments on it, I
amended the existing thread in place rather than making a new one:
https://discuss.python.org/t/pep-642-constraint-pattern-syntax-for-structural-pattern-matching/5614
The full text of the PEP is quoted in the Discourse thread.
The rendered version of the updated PEP can be found in the usual
place: https://www.python.org/dev/peps/p... continue reading
Hi,
I'm happy to announce that iPOPO has been relased in v1.0.1.
iPOPO is a Service-Oriented Component Model (SOCM) based on Pelix,
a dynamic service platform. Both are inspired on two popular Java
technologies for the development of long-lived applications:
the iPOJO component model and the OSGi Service Platform.
iPOPO enables to conceive long-running and modular IT services.
It is based on the concepts specified by OSGi:
Hi,
If you embed Python in Python, I would like your opinion on
https://bugs.python.org/issue42260 issue which adds a way to configure
the Python initialization in Python.
I'm looking for feedback from people who embed Python and have issues
to configure Python as they wish.
import _testinternalcapi
import sys
assert sys.flags.bytes_warning == 0
config = _testinternalcapi.get_con... continue reading
Hi,
Not clear on where to report this - so I hope someone else sees the same
and can notify whoever needs to be notified.
The main URL for downloads: https://www.python.org/downloads/ Opens with
message :
Notice: While Javascript is not essential for this website, your
interaction with the content will be limited. Please turn Javascript on
for the full experience.
However, javascript is enabled in my browser (FF latest). Also tried
with Chrome - same (messy) layout.
The main page, an... continue reading
Currently, the simplest and most idiomatic way to check whether a module was
run as a script rather than imported is:
if __name__ == "__main__":
People generally learn this by rote memorization, because users often want the
ability to add testing code or command line interfaces to their modules before
they understand enough about Python's data model to have any idea why this
works. Understanding what's actually happening requires you to know that:
I have read a great deal of discussion on the pattern matching PEPs and
less formal discussions. It is possible I have overlooked some post in all
of that, of course.
... OK, just saw Guido's "wait for new SC" comment, which I suppose applies
to this too :-).
One idea that I cannot recall seeing, but that seems to make sense to me
and fit with Python's feel is using a WORD to distinguish between a
variable value and a binding target. That is, instead of a special symbol
prefixing or suffixin... continue reading
ACTIVITY SUMMARY (2020-11-06 - 2020-11-13)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7628 (+11)
closed 46459 (+62)
total 54087 (+73)
Open issues with patches: 3064
#32426: Tkinter: reference document of possible cursor names
https://bugs.python.org/issue32426 reopened by terry.reedy
#32682: test_zlib im... continue reading
(my first post here after years of lurking)
PEP 635 mentions: "A proposed rule to use a leading dot (e.g. .CONSTANT) for that purpose was criticised because it was felt that the dot would not be a visible-enough marker for that purpose. Partly inspired by forms found in other programming languages, a number of different markers/sigils were proposed (such as ^CONSTANT, $CONSTANT, ==CONSTANT, CONSTANT?, or the word enclosed in backticks), although there was no obvious or natural choice."
Did any... continue reading
Lea 3.4.0 is now released!
---> http://pypi.org/project/lea/3.4.0
Lea is a Python module aiming at working with discrete probability
distributions in an intuitive way.
It allows you modeling a broad range of random phenomena: gambling, weather,
finance, etc. More generally, Lea may be used for any finite set of discrete
values having known probability: numbers, booleans, date/times, symbols,.
Each probability distribution is modeled as a plain object, which can be
nam... continue reading
From PEP 636 (Structural Pattern Matching):
Mapping patterns: {"bandwidth": b, "latency": l} captures the
"bandwidth" and "latency" values from a dict. Unlike sequence patterns,
extra keys are ignored.
It surprises me that ignoring extra keys would be the default
behavior. This seems unsafe. Extra keys I would think would be best
treated as suspicious by default.
Ignoring extra keys loses data silently. In the current proposal:
point = {'x': 1, 'y': 2, 'z': 3)
match poin... continue reading
Hello,
As was mentioned many times on the list, PEP634-PEP636 are thoroughly
prepared and good materials, many thanks to their authors. PEP635
"Motivation and Rationale" (https://www.python.org/dev/peps/pep-0635/)
stands out among the 3 however: while reading it, chances that you'll
get a feeling of "residue", accumulating a section over section. By the
end of reading, you may get a well-formed feeling that you've read a
half-technical, half-marketing material, which is intended to "sell" a
par... continue reading
Hello,
This is my first mail here, so greetings for everyone :)
I would like to introduce an idea of the new operators for dict objects.
Any thoughts are welcome.
Since Python3.9 there is a great feature for merging dicts using | (OR)
operator:
{1: "a"} | {2: "b"} == {1: "a", 2: "b"}
Thus, this basic operation can be done smoothly (also inline).
PEP: https://www.python.org/dev/peps/pep-0584/
Another common operation on dicts is a substitution - building a new dict with
only a part of the... continue reading
Dear Community,
after our first successful “Ask me Anything” (AMA) session in September
https://blog.europython.eu/post/629951901661790208/europython-ask-me-anything
we want to run another meeting this Thursday to answer any questions you
may have, share our knowledge or help you in planning your online event.
Some of the topics we can cover:
Welcome to pymemtrace, a collection of tools for monitoring and analysing
Python's memory usage including that of Python Extensions.
These tools work at various levels, at different granularities and with
different runtime costs so you can choose one appropriate to the problem at
hand.
They range from periodically measuring total memory usage down to reporting
every malloc and free call per Python line or C function call.
The tools are:
Greetings list,
What do you think of adding PyInstaller as an official
part of CPython? Among the different native exports
options, PyInstaller holds a nice track of clean delivery.
Instead of the project battling for its survival as any other
project, if the community finds it useful enough, the devs
can get some peace of mind.
The stereotyped idea about languages like Python is that
they don't by default produce executables compared to let's
say Go. Adding the native ability to produce exec... continue reading
Microdict v0.1 is released : https://github.com/touqir14/Microdict
What is Microdict?
A high performance python hash table library that is generally faster and consumes significantly less memory than Python Dictionaries. Benchmarks show that it can be upto 7 times more memory efficient in comparison to Python Dictionaries.
Microdict is a typed python dictionary that heavily relies on C extensions. Moreover, benchmarks show that its underlying C implementation can outperform both Google's Swis... continue reading
Starting a new thread for this as suggested by Guido.
On 18/11/20 7:20 pm, Guido van Rossum wrote:
On Tue, Nov 17, 2020 at 22:12 Greg Ewing <greg.ewing@canterbury.ac.nz
mailto:greg.ewing@canterbury.ac.nz> wrote:If there's anything I would change, it would be to have the for statement create a new binding on each iteration, so that capturing it with a def or lambda inside the loop works as expected. I even came up with a way to do that while still allowing the ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/3ZKYV6WQPPWR7SBPKRWW743OPSI22RDA/)
I'm sorry, I've been skipping around the discussion a bit, but I'm fairly
certain this suggestion hasn't been proposed yet.
It's perhaps a bit too different from what has been proposed thus far but
maybe that's exactly what's needed to convince the minds, since as far as I
see it most of the parties who have an opinion on marking either
assignments or lookups would at this point have changed their mind, if they
were going to at all.
What about declaring the identifiers that are going to be loo... continue reading
collections.Counter has most_common([n]) method which returns the most
common n elements of the counter, but in case of a tie the result is
unspecified --- whereas in practice the order of insertion breaks the
tie. For example:
>>> Counter(["a","a","b","a","b","c","c","d"]).most_common(2)
[('a', 3), ('b', 2)]
>>> Counter(["a","a","c","a","b","b","c","d"]).most_common(2)
[('a', 3), ('c', 2)]
In some cases (which I believe are not rare) you would like to break
the tie yourself or get the to... continue reading
Your code reads some data, processes it, and uses too much memory. In order to reduce memory usage, you need to figure out:
Fil an open source memory profiler designed for data processing applications written in Python, and includes native support for Jupyter. It is designed to be high-perfor... continue reading
Hello,
I'm not a Python contributor but I have a question which (I believe) can be
answered here, so I've subscribed.
The question is at stackoverflow:
https://stackoverflow.com/questions/64912716/are-pre-commit-hooks-clonable
After some research the only thing similtar to a git pre-commit hook I
could find on the cpython repo was the patchcheck.py script on
github.com/python/cpython/tree/master/Tools/scripts (patchcheck.py), which
runs in Travis.
Is this the pre-commit hook PEP8 talks about... continue reading
TL/DR: A new built-in attribute who's purpose is to provide a simple way for developers to detect the Python implementation like CPython, JPython, IronPython and PyPy among other information.
Ok, so the reason I'm suggesting this is for another suggestion I'll submit a later date (once I feel this one has ran it's course, or the contributors decide about it).
The goal of this attribute (as mentioned above) is to provide developers quick and simple information about the Python runtime like wheth... continue reading
Hi folks,
I know this is a high-volume list so sorry for being yet another voice
screaming into your mailbox, but I do not know how else to handle this.
A few months ago, I opened a pull request fixing packed bitfields in
ctypes struct/union, which right now are being incorrectly created. The
offsets and size are all wrong in some cases, fields which should be
packed end up with padding between them.
bpo: https://bugs.python.org/issue29753
PR: https://github.com/python/cpython/pull/19850
Sin... continue reading
I was reading the pyinstaller thread and had this idea but didn't want to
hijack.
Maybe a wild idea, and very possible totally impractical or hopelessly
complex, but: could the existing pypi infrastructure be leveraged into a
set of platform-specific app stores? Maybe maybe we could make it as simple
as a single line in a pyproject.toml file.
Imagine if all the end user does is install the store, and clicks the link
to the project app. The store takes care of the rest. The developer marks
thei... continue reading
Hi all,
Some days back Mark Shannon posted his view/proposal pattern matching on github.
While reading it I realised an intermediate step between matching and variable assignment might do away with part of the discussion.
I wrote it in an issue with the view/proposal (https://github.com/markshannon/pattern-matching/issues/1)
Thinking about it a bit longer, it really might be worth exploring the idea more, so let me repeat it here:
Hi,
I'd like to request that any pattern matching PEP and its implementation
meet certain standards before acceptance.
As one of the maintainers of the AST-to-bytecode part of the compiler
and the bytecode interpreter, I don't want to be in the situation where
we are forced to accept a sub-standard implementation because a PEP has
been accepted and the PEP authors are unable, or unwilling, to produce
an implementation that is of a sufficiently high standard.
Therefore, I would ask the ste... continue reading
Greetings all,
We can do one type annotations like list[int] and dict[str, int], my question: why don’t we have a similar thing in matching patterns? Especially if you want to enforce a type on a sequence or a dictionary with unknown length.
For example,
ls = [3.14, ‘hello’, 1, 2, 3, 4, ...]
d = {‘name’: 1, ‘age’: 25, ...}
match ls:
case [float(), str(), *rest] if all(isinstance(elem, int) for elem in rest): ... (do something with rest)
We do the same thing with the following:
... continue reading
ACTIVITY SUMMARY (2020-11-13 - 2020-11-20)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7593 (-35)
closed 46562 (+103)
total 54155 (+68)
Open issues with patches: 3061
#25710: zipimport is not PEP 3147 or PEP 488 compliant
https://bugs.python.org/issue25710 reopened by brett.cannon
#41561: test_ssl fails i... continue reading
I am excited about the potential of the new PEP 634-636 "match" statement to
match JSON data received by Python web applications. Often this JSON data is
in the form of structured dictionaries (TypedDicts) containing Lists and
other primitives (str, float, bool, None).
PEP 634-636 already contain the ability to match all of those underlying
data
types except for TypedDicts, so I'd like to explore what it might look
like to
match a TypedDict...
Consider an example web application that wants t... continue reading
def __eq__(self, other):
return '__eq__'
class B(A):
def __eq__(self, other):
print(super() == other)
print(super().__eq__(other))
B() == ...```
OUTPUT:
False
__eq__
As you can see here, when you run the code, __uq__ does not get printed twice.
somehow, The expression "super() <OPERATOR> other" does not turn into "super().__OPERATOR__(other)".
this bug is for any operator that you apply on super().
I'd be happy to hear from you why it happens and ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/54BWA23335SWGKWLVVN4PR6WUKUMQ7SA/)
I know enhancements to pathlib gets brought up occasionally, but it doesn't
look like anyone has been willing to take the initiative and see things
through to completion. I am willing to keep the ball rolling here and even
implement these myself. I have some suggestions and I would like to
discuss them. I don't think any of them are significant enough to require
a pep. These can be split it into independent threads if anyone prefers.
The big one people keep bringing up that I stron... continue reading
Take as an example a function designed to process a tree of nodes similar to that which might be output by a JSON parser. There are 4 types of node:
The function transforms a tree of nodes, beginning at the root node, and proceeding recursively through each child node in turn. The result is a Python object, with the following transformation applied to ... continue reading
A few days ago, Terry J. Reedy created the issue about the formatter module.
(https://bugs.python.org/issue42299)
The issue is mainly about testing code but also discussing the removal of
the module.
I noticed that the formatter module was deprecated in 3.4 and it was
originally scheduled to be removed in 3.6. But the removal was delayed
until 2.7 EOL.
Now 2.7 is EOL and there is no usage in stdlib.
So IMHO, it is good to remove the formatter module in 3.10
So before removing it, I would like... continue reading
I was thinking about the "Load JSON file as single line" thread from a bit
back, and had an idea for a neat solution, albeit one that has potential
stylistic issues.
Idea:
Create two new methods on pathlib.Path objects:
Path.load(loader, **kwargs)
and
Path.dump(dumper, obj, **kwargs)
Here, loader should be an object that implements a method load(fileobj: BinaryIO, *args, **kwargs) -> object
and dumper should be an object that implements `dump(obj: object,
fileobj: BinaryIO, *arg... continue reading
Python uses an index of -1 to index the last element in a list. Since -1 occurs before 0 we might think of the elements of the linear list are being bent into a circle making the last element occur before the 0th element. Consider a list with n elements: it would be perfectly reasonable to address the element 0 of the list using an index of n since n occurs after n-1 (if we assume that the list is bent into a circle). This feature can prove to be extremely useful. Consider the following example:... continue reading
Excuse me, I have a question about pattern matching: is it used often
in math language as Mathematica? May it help to translate code from
such languages to Python?
As discussed earlier on the post on 'Circular Indexing', considering interpreting indices that lie outside the range 0 to n-1 modulo n for list indexing. Thus element n corresponds to element 0, n+1 to element 1 and so on. This has two consequences:
1.) Makes the Python convention of interpreting index -1 as the last element more logical since -1 is the same as n-1 when taken modulo n. If -1 is the first element then to be logically consistent we have to interpret index n as the element 0 as w... continue reading
Greetings list,
Then I would suggest starting a new thread,
Long overdue i guess. My view on the topic is like
Mr Moore with the exception that i'm for native
capabilities to be in the stdlib. Since Zipapp does
not seem to go the C-extension route, i propose
a new tool that turn projects into independent executables
This solves the issue of Gui etc etc etc etc etc etc
Mr Moore's mail of Nov 24, 2020 has ton of ideas
and a lot of potential
Kind Regards,
Abdur-Rahmaan Janhangeer
about <htt... continue reading
Hi all, this is a general feeler for if this idea has any traction:
All too often I see the following pattern in asyncio 3rd-party libs, either
in their own source code or in the inusage:
inst = SomeClass()
await inst.initialize()
What happens here is that, since coroutines cannot be used inside init
methods, the init method only stores the parameters, and another,
asynchronous method actually initializes the object. This led many
3rd-party libs to use factory methods to create... continue reading
If circular indexing is used then instead of using a double FOR loop to go through a list M times we can iterate from 0 to M*N (where N is the length of the list) !!!
Almost all Machine Learning (ML) algorithms iterate for some predefined epochs over a large data-set. So a double FOR loop is extremely common in ML. Using circular indexing gets rid of this extra FOR loop. If we have to iterate 2 times you can iterate using range(-n,n) but in most cases you need to iterate over 10 or more epochs... continue reading
PyPI: https://pypi.org/project/wxPython/4.1.1
Extras: https://extras.wxPython.org/wxPython4/extras/
Pip: pip install wxPython==4.1.1
New and improved in this release:
Add something like Move type hint to typing module. It will tell the analyzer that the input parameter of the function is moved and can not be used after. For example:
def f(d: Move[dict]) -> dict:
d['a'] = 2
return d
d = {1: 2}
f(d)
print(d[1]) # mistake, using of moved value
Hi everyone,
I just wanted to express some appreciation for the excellent Dev Guide.
I don't use git or github much, but the dev guide got me from not knowing
where to start, to having a PR out for review in a couple hours. It walked
me through...pretty much perfectly.
Getting a CLA signed was also simple and nice. When the bot brought that
up, I thought it'd be a headache big enough to keep the PR from
ever getting back to the top of my todo list. But the help text and links
from the bot, th... continue reading
Python 3.9.1rc1 is the release candidate of the first maintenance release of Python 3.9. Go get it here:
https://www.python.org/downloads/release/python-391rc1/ https://www.python.org/downloads/release/python-391rc1/
Assuming no critical problems are found prior to 2020-12-11, the currently scheduled release date for 3.9.1, no code changes are planned between this release candidate and the final release. That being said, please keep in mind that this is a pre-release of 3.9.1 and as such its m... continue reading
Python 3.9.1rc1 is the release candidate of the first maintenance release of Python 3.9. Go get it here:
https://www.python.org/downloads/release/python-391rc1/ https://www.python.org/downloads/release/python-391rc1/
Assuming no critical problems are found prior to 2020-12-11, the currently scheduled release date for 3.9.1, no code changes are planned between this release candidate and the final release. That being said, please keep in mind that this is a pre-release of 3.9.1 and as such its... continue reading
When optimizing code, I often need to timeit a part of code or a function.
I am using then the following class
import logging
import time
from functools import wraps
from typing import Optional
_logger = logging.getLogger("Timer")
class Timer:
def __init__(self, description: Optional[str] = None, logger: Optional[logging.Logger] = None):
self.description = "<anonymous code block>" if description is None else description
self.logger = _logger if logger is None else logge... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/UY2MS4T64SX4JYTACACEHZD3OGHVRGDT/)
ACTIVITY SUMMARY (2020-11-20 - 2020-11-27)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7579 (-14)
closed 46642 (+80)
total 54221 (+66)
Open issues with patches: 3054
#28468: Add platform.freedesktop_os_release()
https://bugs.python.org/issue28468 reopened by christian.heimes
#42392: remove the 'loop' para... continue reading
Over the last few weeks, Anthon van der Neut, our media work group chair
for EP2015 and EP2016, put in a lot of effort into getting all our
conference videos on archive.org, the Internet Archive.
Archive.org is not meant as an alternative for YouTube to watch the
videos, but it allows you to retrieve the original uploads, and as such
also functions as a backup location for the us and the community.
He first downloaded all videos from our YouTube account (over 2.5TB as
of this writing), then en... continue reading
In the current python codebases, there are a lot of decorators with parameters, and their code in most cases contains a lot of code boilerplates. The purpose of this feature is to add decorator_with_params (I think the name can be changed to smth better) function to functools module. This function will allow using a decorated function as a simple decorator and decorator with parameter.
I believe the real example will bring more context, for instance, typing._tp_cache function can be rewr... continue reading
Instead of importing “Any" from the typing module, we can annotate our functions with “Any" right away without the extra step. What do you think? We have the builtin function “any” which some Python users could mistakingly use, but static type checkers should catch that.
Hello,
This is continuation of the "Making the for statement work better with
nested functions" thread
(https://mail.python.org/archives/list/python-ideas@python.org/thread/3ZKYV6WQPPWR7SBPKRWW743OPSI22RDA/).
I post this as a separate thread to draw more attention to and promote
this way of prototyping Python changes.
The changes are implemented using Python3 port of Python2's "compiler"
module: https://github.com/pfalcon/python-compiler . For more
information on background, see the parallel ... continue reading
On behalf of the PyPA and the pip team, I am pleased to announce that we have just released pip 20.3, a new version of pip. You can install it by running python -m pip install --upgrade pip.
This is an important and disruptive release -- we explained why in a blog post last year. We
even made a video about it.
On behalf of the Python Packaging Authority, I am pleased to announce
that we have just released pip 20.3, a new version of pip. You can
install it by running python -m pip install --upgrade pip.
This is an important and disruptive release -- we explained why in a
blog post last year
https://pyfound.blogspot.com/2019/12/moss-czi-support-pip.html . We even
made a video about it: https://www.youtube.com/watch?v=B4GQCBBsuNU .
Blog post with details:
https://pyfound.blogspot.com/2020/11/pip... continue reading
On behalf of the Python Packaging Authority, I am pleased to announce
that we have just released pip 20.3, a new version of pip. You can
install it by running python -m pip install --upgrade pip.
This is an important and disruptive release -- we explained why in a
blog post last year
https://pyfound.blogspot.com/2019/12/moss-czi-support-pip.html . We even
made a video about it: https://www.youtube.com/watch?v=B4GQCBBsuNU .
Blog post with details:
https://pyfound.blogspot.com/2020/11/pip... continue reading
Hello,
(This is the full version of the proposal. You can start with
"abstract" of it at
https://mail.python.org/archives/list/python-ideas@python.org/thread/ZLQ5KJLG2LD4B7VIU2CEQ256CZ7NCUGV/).
Created Saturday 21 November 2020
This proposal seeks to introduce opt-in "strict execution mode" for
Python language implementations interested in such a feature. Under
this mode, some "overdynamic" language features are restricted in a
reasonable way. The primary motiva... continue reading
Hello,
Recently, there was a discussion of language-level (vs just
stdlib-level, like currently done by "typing" module) "const"
annotation. The discussion mentioned that the initial
implementation would have the best-effort semantics, i.e. don't
guarantee "full" constant semantics, effectively, in its baseline,
being the same annotation as any other. There was immediately raised a
question how a full, eventual implementation would look like, and the
posted proposal showcases one of the optio... continue reading
I'm seeing the need to strip annotations from type hints after they've
been fetched using get_type_hints(..., include_extras=True). There's a
convenient function, typing._strip_annotations,which does exactly that.
Why not make it public?
Hi there,
I'm proposing a new builtin method b which is a shorthand for the already-builtin method breakpoint. Let me just show you a scratch implementation: (Yes, I am serious)
b = breakpoint
PEP 553 proposed the builtin method breakpoint() (12 characters) as a shorthand for import pdb; pdb.set_trace() (27 characters), but it still contains a lot of characters and is easy to typo. Yeah, we have auto-completion to cope with this, but if you are using a full-fledged IDE chances... continue reading
Hi, sometimes I do nested loops and I want to break specific loop, outer/inner etc.
I need to do an ugly thing with for..else and it's annoying.
It'd be nice if we could do so:
for i in range(10) as loop_i:
for j in range(i, i + 10) as loop_j:
if i + j == 9:
break loop_i
or something like this.
Please comment what do you think about this idea.
Hi all,
I just sniped myself wondering about how correct dispatching for
dunders works for independently derived subclasses.
This is an extreme corner case where two subclasses may not know about
each other, and further cannot establish a hierarch:
class A(int):
pass
class B(int):
def __add__(self, other):
return "B"
def __radd__(self, other):
return "B"
print(B() + A()) # prints "B"
print(A() + B()) # prints 0 (does not disp... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/NDDYQG37YRRZCUWQGST4ALUYTZA62AVI/)
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.20.0rc1. This NumPy release is the largest to date, containing some 654
merged pull requests contributed by 182 people. See the list of highlights
below. The Python versions supported for this release are 3.7-3.9, support
for Python 3.6 has been dropped. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.20.0rc1/; source archives, release
notes, and wheel hashes are available on Github... continue reading
On https://www.python.org/doc/ I notice that on the right side, under the
heading "Porting from Python 2 to Python 3", there is one bullet point that
is not linked to anywhere and just sits as plain text: "Determine what
projects are blocking you from porting to Python 3". It seems like a weird
place to have a bullet point of plain text that's quite a bit more specific
than surrounding bullets.
Is this line of text supposed to be on a different page? Is it supposed to
be linked to another page ... continue reading
ACTIVITY SUMMARY (2020-11-27 - 2020-12-04)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7561 (-18)
closed 46745 (+103)
total 54306 (+85)
Open issues with patches: 3050
#41879: Outdated description of async iterables in documentation of as
https://bugs.python.org/issue41879 reopened by nickgaya
#42491: Tkin... continue reading
[Steven D'Aprano steve@pearwood.info responding to Paul Sokolovsky] wrote:
Let us be clear: failed matches do not affect
surrounding
namespaces unless you declare capture variables as global or
nonglobal. They might affect the current namespace, but not
surrounding namespaces. Failed matches will not leak out to
surrounding namespaces.
The problem is that intuitively (just like with "for"),
"case a, b if a != b:" opens a new namespace for "a" and "b". That's why
... continue reading
It would be nice to have "Typed Python" mode that will look like this:
#!/usr/bin/env bash
set -e
python -m mypy $1
python $1
https://gist.github.com/redradist/dd7253a55081a4dc13fdf3f1549f43b5
It could be achieved by adding special flag like -t (typed)
Is this the expected behavior?
Python 3.9.0 (default, Oct 7 2020, 23:09:01)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import typing
TD = typing.TypedDict("TD", {"a": str}, total=False)
TD.total
False
TD.required_keys
frozenset({'a'})
TD.optional_keys
frozenset()
It seems to me "a" should not be a required key, but in fact an
optional key.
there are stat fields now for ns precision, e.g. st_mtime now has an
analogue st_mtime_ns. But os.path didn't grow corresponding methods -
there's an os.path.getmtime but not _ms. Was that intentional? The
wrappers in genericpath.py are trivial and arguably aren't particularly
needed, but still curious...
After much deliberation, the 2020 SC will be making a recommendation to the
2021 SC to accept PEP 634 (although this was not a unanimous decision).
This is in no way a binding recommendation to the 2021 SC (even if a
majority of current council members get re-elected), but we felt we should
pass on our thoughts to the next council as we have been discussing pattern
matching for a few months at this point and we promised we would make some
decision to the PEP authors.
Dear All,
On behalf of the Astropy Project, I am pleased to announce the v4.2 release
of astropy, the core Python package for astronomy. This astropy release
supports Python 3.7-3.9 and Numpy 1.17+.
This release includes new functionalities, fixes and improvements for 183
issues, 105 pull requests, from 63 contributors. An overview is provided at
this page:
https://docs.astropy.org/en/stable/whatsnew/4.2.html
For a full list of the changes, please consult the Changelog:
https:... continue reading
It's starting to get very cold (at least on the Northern hemisphere) so we
have been carefully packaging a total of three new Python releases to keep
you warm these days!
Python 3.9.1 is the first maintenance release of Python 3.9, and also the
first version of Python to support macOS 11 Big Sur natively on Apple
Silicon. Go get it here:
https://www.python.org/downloads/release/python-391/
Maintenance releases for the 3.9 series will continue at regular bi-monthly
intervals, with *... continue reading
It's starting to get very cold (at least on the Northern hemisphere) so we
have been carefully packaging a total of three new Python releases to keep
you warm these days!
Python 3.9.1 is the first maintenance release of Python 3.9, and also the
first version of Python to support macOS 11 Big Sur natively on Apple
Silicon. Go get it here:
https://www.python.org/downloads/release/python-391/
Maintenance releases for the 3.9 series will continue at regular bi-monthly
intervals, with 3.9.2 pl... continue reading
Hello,
It would be nice to have a simple and easy way to override module
importing, instead of that babylon which CPython has in that regard.
(Even if initially "limited" to filesystem importing, most people
won't ever find that limiting at all.)
The desired semantics would be:
For "import foo", before "/path1/foo.py", "/path2/foo.py" (where
/path1:/path2 come from sys.path) is tried to be imported, a
user-defined hook function can be called. It should take just one param
I am not sure if this has been suggested before, so my apologies if it has.
I would like to propose adding lazy types for casting builtins in a lazy fashion. e.g. lazy_tuple which creates a reference to the source iterable and a morally immutable sequence but only populates the tupular container when it or the source is used.
Note that if the original object is not a built-in, will not be used after casting or is immutable, this is trivial to implement. The difficulty arises when this it ... continue reading
PyDev 8.1.0 Release Highlights
Interactive Console
Debugger (updated to pydevd 2.2.0)
PyOxidizer's pure Rust implementation of a meta path importer (
https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_oxidized_finder.html)
has been surprisingly effective at finding corner cases and behavior quirks
in Python's importing mechanisms.
It was recently brought to my attention via
https://github.com/indygreg/PyOxidizer/issues/317 that "init" in module
names is something that exists in Python code in the wild. (See
https://github.com/search?l=Python&q="from+.__init__+im... continue reading
Regarding the 3.8.7rc1 release, I wanted to raise some issues regarding
macOS.
Without the changes from https://github.com/python/cpython/pull/22855
backported, attempting to build a portable binary on macOS 11 (e.g. by
setting MACOSX_DEPLOYMENT_TARGET=10.9) results in a myriad of warning: 'XXX' is only available on macOS 10.13 or newer [-Wunguarded-availability-new] warnings during the build. This warning
could be innocuous if there is run-time probing in place (the symbols in
question are... continue reading
What is cx_Oracle?
cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.
Where do I get it?
https://oracle.github.io/python-cx_Oracle
The easiest method to install/upgrade cx_Oracle is via pip as in
python -m pip install cx_Oracle --upgrade
What's new?
See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/lates... continue reading
PyCA cryptography 3.3 has been released to PyPI. cryptography includes both
high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, asymmetric algorithms, message
digests, X509, key derivation functions, and much more. We support Python
2.7, Python 3.6+, and PyPy.
Please note that this is the final version that will support Python 2.7!
Changelog (https://cryptography.io/en/latest/changelog/):
Hi
I like using itertools for creating long strings while not paying the cost of intermediate strings (by eventually calling str.join on the whole iterator).
However, one missing feature is to mimic the behavior of str.join as an iterator: an iterator that returns the items of an iterable, separated by the separator.
I suggest name "interleave" or "join" (whichever is the most clear / least ambigous).
def interleave(sep, iterable):
"""
Makes an iterator that returns elements from an itera... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/YWT5BVGPNO3UBW4DZYYPXVCJY2JH7B4H/)
It appears that when from future import annotations, a type hint
annotation derived from a closure loses scope.
Simplistic example:
Python 3.9.0 (default, Oct 7 2020, 23:09:01)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
def make_a_class(data_type):
... class Foo:
... def put_data(self, data: data_type):
... self.data = data
... return Foo
...
import typing
foo = make_a_class(str)()
typing.get_t... continue reading
In response to the additional work required to convert the new python
dataclass using the json encoder I propose an encode method that will
be included in the default dataclass attributes. This would then be picked
up by the default json encoder and called to encode the object. Using a
common encode tag would allow the solution to also be applied to custom
objects and other new objects without needing to update all json encoders.
The encode method would work similar to repr but o... continue reading
Greetings!
I'm hoping somebody can alleviate my confusion. I had thought that the blurb tool was created to resolve the
near-constant push races when the NEWS file was updated; but it appears that it only affects the change log.
If I have a change that really needs to be in the NEWS file itself, do I need to directly edit that file?
--
~Ethan~
PyCA cryptography 3.3.1 has been released to PyPI. cryptography includes
both high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, asymmetric algorithms, message
digests, X509, key derivation functions, and much more. We support Python
2.7, Python 3.6+, and PyPy.
Please note that this is the final version that will support Python 2.7!
Changelog (https://cryptography.io/en/latest/changelog/):
Hi,
I vaguely recall that PEP 617 "New PEG parser for CPython" was
supposed to deprecate the lib2to3 module and the 2to3 program.
I see that lib2to3/init.py contains a PendingDeprecationWarning in
Python 3.9. Can it be converted into a regular DeprecationWarning and
document the deprecation in Doc/library/2to3.rst?
--
Do we still want to maintain lib2to3? People who didn't migrate to
Python 3 can use 2to3 of Python 3.9 or Python 3.10. There are also
other tools like 2to6, modernize, etc.... continue reading
Hello,
Pycopy is a minimalist, lightweight, resource-efficient implementation
of Python(-like) language. Pycopy to CPython is a similar thing as
Scheme to Common Lisp. Executable sizes of 300-400KB, instant startup,
no need to carry around large monolithic library consisting largely of
legacy modules - some but not all of Pycopy's features.
Project page: https://github.com/pfalcon/pycopy
Now has website too: https://pycopy.github.io/
The 3.4.0 release implements initial version of "strict ex... continue reading
Per PEP 563:
Most importantly, Guido van Rossum explicitly stated interest in
gradually restricting the use of annotations to static typing (with
an optional runtime component).
As I'm working on runtime type encoding and validation using type
annotations, this passage raises a bit of a concern, as I don't know
what is meant by optional runtime component.
Looking for any discussion on this. I checked:
https://bugs.python.org/issue38605
https://github.com/ambv/static-annotations/issues?... continue reading
With PEP 563 behavior going mainstream in Python 3.10, I see some
ramifications, especially for runtime validation of type hints:
PEP 563 is changing the scope of evaluation of type hints, and in
some cases it is not feasible to move that scope to the annotated
object's globals. (I appreciate the reality that such cases would evade
static type checkers.)
The typing.get_type_hints function causes annotation(s) to be
evaluated from strings for every call, incurring a potentially
significan... continue reading
ACTIVITY SUMMARY (2020-12-04 - 2020-12-11)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7567 ( +6)
closed 46791 (+46)
total 54358 (+52)
Open issues with patches: 3047
#39707: Abstract property setter/deleter implementation not enforced,
https://bugs.python.org/issue39707 reopened by josh.r
#39825: EXT_SUF... continue reading
I'm not sure if this has been asked / suggested before.
I'm wondering if there is any interest in conditional or loop-based with
statements. I think it could be done without a syntax change.
Context managers could define __if__ or __for__, and if those dunder
methods were defined, then the with statement would either behave like a
conditional or a loop.
If __if__ was defined then
with Ctx():
print('hi')
would only print hi if __if__ returned Tr... continue reading
The pytest team is proud to announce the 6.2.0 release!
This release contains new features, improvements, bug fixes, and breaking changes, so users
are encouraged to take a look at the CHANGELOG carefully:
https://docs.pytest.org/en/stable/changelog.html
For complete documentation, please visit:
https://docs.pytest.org/en/stable/
As usual, you can upgrade from PyPI via:
pip install -U pytest
Thanks to all... continue reading
Hiya :)
I'm recently working with tkinter and I noticed that:
import tkinter as tk
string_var = tk.StringVar()
is throwing an AttributeError:
Traceback (most recent call last):
. . .
File "...\lib\tkinter_init_.py", line 505, in init
Variable.init(self, master, value, name)
File "...\lib\tkinter_init_.py", line 335, in init
self._root = master._root()
AttributeError: 'NoneType' object has no attribute '_root'
... which is making me quest... continue reading
Enum is great! Okay, okay, my opinion might be biased. ;)
There is one area where Enum is not great -- for a bunch of unrelated values. What would be nice is if we had something
similar to Enum for the
While I was looking in the stdlib for an example, I came across sre_constants, which was chock full of constants -- and
it even has a minimal version of what I'm proposing:
class _NamedIntConstant(int):
def __new__(cls, ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/Q4UU6U4FEADHFHJQ6XMH5MQMEASUQPYZ/)
Hello,
How would you feel if explicit parens were used to convey additional
semantic meaning? That seems like a pretty dumb question, because,
well, parens are used to convey additional semantic meaning. E.g.:
1 + 2 + 3 vs 1 + (2 + 3)
The result is the same, but somehow I wanted to emphasize that 2 and 3
should be added together, and somehow else.
a + b + c vs a + (b + c)
Here, there's even no guarantee of the same result, if we have user
objects with weirdly overloaded add().... continue reading
PR 22981 is a minor update to doctest to allow it to safely consume
modules which contain objects that cause inspect.unwrap to throw.
I believe the review comments in the PR have been addressed at this
point for ~20 days. The patch is relatively small, reviews are done,
but it is unmerged.
Is there a way to "bump" the request for review?
thank you,
-Alfred
Hello,
Greetings!
I have the following idea of adding a function in Lib/datetime.py which when called with the datetime.date object returns the months between the object datetime.date and the object datetime.date passed as the date_to argument in function. Herewith is the attached link to the commit:
https://github.com/python/cpython/pull/23713/commits/2941fe88bd9c0c1a5c8ddd4f0458d52d27d7ec57
Kind regards,
Hello!
I'm pleased to announce version 3.9.0, the first release
of branch 3.9 of SQLObject.
Contributors for this release are:
Michael S. Root, Ameya Bapat - JSONCol;
Jerry Nance - reported a bug with DateTime from Zope.
JSONCol: a universal json column that converts simple Python objectspytest 6.2.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
Hello guys,
First time for me to submit a feature request for python.
A lot of time we try to use a member variable as the default value of a member function argument. So we write the code like this:
class A:
def __init__(self, a: int = 3):
self.a = a
def func(self, a: int = None):
if a is None:
a = self.a
a += 1
return a
This seems okay, but when there are more than 10 arguments need to set their default values as correlated me... continue reading
Hello,
I hope this is the correct place to ask this question. I have a desire to
participate in python development in a particular area from my Windows host
machine, but I am not finding any concise listing of the tool setup needed
to fully participate, nor any detailed guidance on how to proceed when
underlying code debugging is necessary.
I do know that some version of the MS VS20xx suite is necessary to begin.
My initial attempts using the VS2019 Community Edition have been less than
succe... continue reading
Many open-source developers are committing to several projects, developing package (for Python). A fraction of developers might need funds for the continuing development of several projects and to pursue contributing. Sadly, there is no direct short way for donors to fund python package developers. There is no particular function in the python package installer(pip) and the site.
A command-line argument for listing the funding pages of package developer for packages installed by them (global o... continue reading
Many open-source developers are committing to several projects, developing package (for Python). A fraction of developers might need funds for the continuing development of several projects and to pursue contributing. Sadly, there is no direct short way for donors to fund python package developers. There is no particular function in the python package installer(pip) and the site.
A command-line argument(pip3 fund) for listing the funding pages of package developer for packages installed by the... continue reading
Hi all,
Dataclasses provide a unique way of creating parameter bags with decent
typing and validation options. However, they currently lack a meaningful
way of detecting a missing value as a dataclass interface consumer.
Current behavior allows us to specify defaults per property, but defining a
default value has consequences for the reusability of the dataclass,
especially when it comes to inheritance patterns. Aside from this effect,
littering the code with str_field: str = MISSING_STR doe... continue reading
I'm pleased to announce the release of Datatest version 0.11.0.
Datatest implements a system of validation methods, difference
classes, and acceptance context managers. It can be used directly
in your own projects or as part of a testing framework like pytest
or unittest.
This is a large and long-awaited update. If you are upgrading
from an older version of datatest, pay special attention to the
installation steps below.
HIGHLIGHTS INCLUDE:
Hi All,
I posted a proposal in Python ideas that I think deserves to be discussed
among core devs and the community. In short, it aims at providing a way of
customizing Python startup in a similar way of what sitecustomize provides
today.
Link to the discourse thread:
https://discuss.python.org/t/add-folder-for-python-customizations-sitecustomize/6190
Link to the proposal in a pepish format:
https://gist.github.com/mariocj89/36daffd1e157b93e5c697bbadcb05806
I'd appreciate feedback in the disc... continue reading
ACTIVITY SUMMARY (2020-12-11 - 2020-12-18)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7554 (-13)
closed 46857 (+66)
total 54411 (+53)
Open issues with patches: 3040
#15651: PEP 3121, 384 refactoring applied to elementtree module
https://bugs.python.org/issue15651 reopened by vstinner
#26564: Malloc debug... continue reading
Maybe it's a crazy idea, but what if we could decorate a single line
of code? For example:
@Timer
a = time_consuming_function()
This will be equivalent to using Steven's context manager, but the
decorator is more simple to comment and uncomment.
Maybe it could be possible to comment also code blocks:
@parallel
for x in y:
do_something(x)
now_something_completely_different(x)
This could be a shortcut for multiprocessing.
Sorry -- I can't find the thread, but there was a discussion on this list
about whether there should be a built in for clearing the terminal screen.
I'm was on the fence about it -- but one more data point:
One of my beginning Python students just submitted code with this in it:
def clear_screen():
'''
Function: clear_screen() (Windows/Unix)
Input: None
Process: Clear Screen
Output: None
'''
if (opSys == 'Windows'):
os.system('cls')
else:
... continue reading
Sorry -- I can't find the thread, but there was a discussion on this list
about whether there should be a built in for clearing the terminal screen.
I'm was on the fence about it -- but one more data point:
One of my beginning Python students just submitted code with this in it:
def clear_screen():
'''
Function: clear_screen() (Windows/Unix)
Input: None
Process: Clear Screen
Output: None
'''
if (opSys == 'Windows'):
os.system('cls')
else:
... continue reading
Sometimes it is useful to get the number of tasks currently holding the
semaphore. Currently, assuming that every call to acquire is paired with a
call to release in the same task (e.g. the semaphore is only used in
[async] with statements), one can do
INITIAL_VALUE - sem._value
where INITIAL_VALUE is the value that was used to construct the semaphore
and sem is the semaphore object. But, as the name indicates, sem._value
is intended for internal use only.
I would proposing exposing thi... continue reading
Hi!
Sometimes you have to put docstrings in stub files e.g. when using code
generation. In that case, stubs are the only place you can locate "objects"
to add docstrings to.
Thus it is frustrating to find that docstring-related software generally
tends to ignore the presence of docstrings in stubs or to work incorrectly
with those.
I think we need a PEP to clarify the interaction between stubs and
docstrings. This PEP might also encourage developers of docstring-related
software to mind docst... continue reading
Hello,
Some time ago we discussed with Steven D'Aprano how "const" annotation
would be combined with other annotations:
https://mail.python.org/archives/list/python-dev@python.org/message/SQTOWJ6U5SGNXOOXZB53KBTK7O5MKMMZ/
I mentioned that while current way is to use typing.Annotated:
spam: Annotated[Widget, const] = build_widget(*args)
, it looks ugly, and we can shoot for better. I proposed to use "&" to
combine annotations:
spam: Widget & const = build_widget(*args)
Today I came by ... continue reading
Title says it all. This might have been an oversight while making this
class. If not please let me know why it was not included!
Thank you for considering my request!
Andres 🙃
Should this be considered a bug in the Enum implementation?
class Foo(enum.Enum):
... A = True
... B = 1
... C = 0
... D = False
...
Foo.A
<Foo.A: True>
Foo(True)
<Foo.A: True>
Foo(1)
<Foo.A: True>
Seems to me like it should store and compare both type and value.
Paul
Hi everyone,
It's been awhile since the last update to NumExpr, mostly as the existing
scientific
Python tool chain for building wheels on PyPi became defunct and we have
had to
redevelop a new one based on cibuildwheel and GitHub Actions. This
release also
brings us support (and wheels for) Python 3.9.
There have been a number of changes to enhance how NumExpr works when NumPy
uses MKL as a backend.
... continue reading
Hi Python-Ideas,
I was browsing the source code to the sqlite3 standard library module
(as one does over the Christmas holidays) and was surprised to find that
the eviction mechanism for cached prepared statements is fairly broken
... and has been for the last 15 years! This is just from reading the
source code, so hopefully I've not made a fool of myself by misreading
it. I've reported the problem to the upstream pysqlite repository:
https://github.com/ghaering/pysqlite/issues/141
This... continue reading
Hi Python-Ideas,
I was browsing the source code to the sqlite3 standard library module
(as one does over the Christmas holidays) and was surprised to find that
the eviction mechanism for cached prepared statements is fairly broken
... and has been for the last 15 years! This is just from reading the
source code, so hopefully I've not made a fool of myself by misreading
it. I've reported the problem to the upstream pysqlite repository:
https://github.com/ghaering/pysqlite/issues/141
This... continue reading
This isn't so much an idea for Python, as a request for ideas to solve a
problem in Python.
Back in the early days of Python, printing recursive lists could crash
the interpreter:
a = [1, 2, 3]
a.append(a)
print(a)
If you try that today, you get a nice display:
[1, 2, 3, [...]]
It's not just lists that we can have this. Dicts and nearly any object
can too:
d = {}
d[None] = d
class Demo:
pass
x = Demo()
x.attr = x
With a bit of jiggery-pokery,... continue reading
Hello all,
I suppose asyncio.to_thread uses concurrent.futures.ThreadPoolExecutor under the hood, so it saves us from getting the running event loop and calling the loop.run_in_executor function . Why don’t we have a similar function for the ProcessPoolExecutor, e.g. asyncio.to_process?
Abdulla
I’ve made a final round of updates to PEP 642 and submitted it to the
Steering Council for consideration alongside PEP 634.
As usual, the rendered version can be found here:
https://www.python.org/dev/peps/pep-0642/
There's a Discourse thread at
https://discuss.python.org/t/pep-642-v3-explicit-pattern-syntax-for-structural-pattern-matching/6459,
and the rest of the email covers the same points as the opening post
in that thread.
There are some pretty significant changes relative to v2, althou... continue reading
I'm pleased to announce version 0.11.1 of Datatest: Test driven
data-wrangling and data validation.
Test driven data-wrangling is a process for taking data from a source of
unverified quality or format and producing a verified, well-formatted
dataset. It repurposes software testing practices for data preparation and
quality assurance projects.
I've been exploring dataclasses for a few months now and they've proven to be very useful.
The only downside is that there's not a simple way to use descriptors.
Descriptors only work on class attributes (as per the docs: https://docs.python.org/3/howto/descriptor.html#closing-thoughts). This means that to use a descriptor in a data class we have to use typing.ClassVar like this
@dataclass
class Item:
name: str
price: typing.ClassVar[Decimal] = PriceValidator()
Which is totally fine ... continue reading
Hello,
There're tons of projects which introduce alternative braces
(i.e. C-like) syntax for Python. Most of them are however not properly
documented, and definitely not spec'ed for what they do.
I wonder, does anyone here remember more or less formal proposal for
braces syntax? A "minimum viable product" criteria would be
support for lossless indent -> braces -> indent syntax roundtripping.
--
Best regards,
Paul mailto:pmiscml@gmail.com
Hello- This is a draft of a future PEP regarding capturing wheel build dependencies in pyproject.toml. I am looking for any critique or input prior to creating a PR against the PEP repository, Thank you!
Previous discussion can be seen here:
PEP: 9999
Title: Build Dependency Specific... continue reading
Greetings list,
put simply,
be able to use
$ python -m venv venv_name activate
To activate an env instead of having each platform have a way of
handling it
Kind Regards,
Abdur-Rahmaan Janhangeer
about https://compileralchemy.github.io/ | blog
https://www.pythonkitchen.com
github https://github.com/Abdur-RahmaanJ
Mauritius
Happy new year to all of you. I hope you all have a great start of the
year! And how to best celebrate that we have left 2020 behind that with a
new Python alpha release? :) Go get it here:
https://www.python.org/downloads/release/python-3100a4/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This releasee, 3.10.0a4 is the second
of six planned alpha releases.
Alpha releases are intended to make it easier to test the current state of
n... continue reading
Happy new year to all of you. I hope you all have a great start of the
year! And how to best celebrate that we have left 2020 behind that with a
new Python alpha release? :) Go get it here:
https://www.python.org/downloads/release/python-3100a4/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This releasee, 3.10.0a4 is the second
of six planned alpha releases.
Alpha releases are intended to make it easier to test the current state of
new features... continue reading
Hi! I've been busily working on a new book on image processing with Python
that uses the Pillow package. Pillow is the friendly fork of the Python
Imaging Library and is one of the most popular Python image processing
tools.
If you'd like to learn more, you can check out my Kickstarter:
https://www.kickstarter.com/projects/driscollis/image-processing-with-python
Here are some of the topics that the book will cover:
Hi everyone,
I’m happy to announce the release of structlog 20.2.0! As the version indicates, I’ve published it in 2020, but I wanted to wait with the announcement until y’all are back to sober from celebrating the end of a hell of a year!
With more than half a million downloads per month, structlog is the most popular solution for structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out <https://www.st... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.19.5. NumPy 1.19.5 is a short bugfix release. Apart from fixing several
bugs, the main improvement is an update to OpenBLAS 0.3.13 that works
around the Windows 2004 fmod bug while not breaking execution on other
platforms. This release supports Python 3.6-3.9 and is planned to be the
last release in the 1.19.x cycle. NumPy Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.19.5/, sour... continue reading
I'd like to have an option to force the path separator for the
"os.path.join()" method.
E.g. if I run the script on Windows, but I generate, say, an URL, I'd
find it convenient
to use the same method, but with an explicit flag to "join" with the
forward slash (because URLs use it).
Currently I simply use an f-string to combine a path, like e.g.:
path = f"{root}/{dir}"
but it will insert extra "/" if there if "root" already has "/" on the end.
But the "join" method will not, which is a pro... continue reading
Dear Pythonistas and solar power enthusiasts,
On behalf of the maintainers, we're happy to announce a new release of
pvlib python:
software for simulating performance of photovoltaic solar energy systems.
See what's new for v0.8.1:
Releases are available from PyPI and the conda-forge channel:
Read the Documentation:
I mentioned this off-hand in the other thread, but the more I think about it the more I think it is a reasonable compromise between the two schools of thought on PEP 533.
Wouldn't the new PEG parser allow a "closed for" statement without breaking code that uses "closed" as a variable (it would be a context sensitive keyword)?
The users who work in the space that cares about such things can start writing:
closed for document in read_newline_separated_json(path):
...
Instead of:
with cl... continue reading
We are currently working out the format for this year’s online
EuroPython conference. The conference will be run using online
conference tools during the week of July 26 - August 1 and we would like
to learn about your preferences regarding the overall structure.
For this reason, we’re running a poll to gather input from our
(potential) attendees:
* EuroPython 2021 Format Poll *
https://forms.gle/V4oPEXWiexfVyH1S7
Please add any comments you may have to the com... continue reading
ACTIVITY SUMMARY (2021-01-01 - 2021-01-08)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7549 ( -7)
closed 47055 (+71)
total 54604 (+64)
Open issues with patches: 3026
#42807: smtplib send_message should gives more clear exception if the
https://bugs.python.org/issue42807 opened by oon
#42808: Add PyType_T... continue reading
Sorry if I'm out of the loop here, but with Apple's new chip coming out, we
need new a build configuration (which I think has already been started, if
not done).
Perhaps we could take this opportunity to better modularize / unify the
build setup?
As it was last I checked, you really had only two options:
Ignore anything mac specific, and get a "unix" build.
Get a full "Framework" build, optionally with Universal support.
It would be nice to keep the Framework structure independent of ... continue reading
Today I had a need: I had a tuple of dynamic sequence-like objects. I
wanted to iterate on them reversed, starting with items of the last one and
slowly making my way towards the first one.
In short, I want reversed(itertools.chain(x, y, z)) that behaves like
itertools.chain(map(reversed, (z, y, x))).
What do you think?
Someone reported a testsuite break on stuff I work on (scons) with
3.10a4, and it looks similar to this which appears in the changelog at
https://docs.python.org/3.10/whatsnew/changelog.html#changelog
bpo-23898: Fix inspect.classify_class_attrs() to support attributes with
overloaded eq and bool. Patch by Mike Bayer.
Except when I go look at that BPO issue, it's old - closed 2015. Is
this appearing in the 3.10 changelog in error? Sorry - confused !!!
The test in question does ... continue reading
Hi,
In the Python stdlib, many heap types currently don't "properly"
(fully?) implement the GC protocol which can prevent to destroy these
types at Python exit. As a side effect, some other Python objects can
also remain alive, and so are not destroyed neither.
There is an on-going effect to destroy all Python objects at exit
(bpo-1635741). This problem is getting worse when subinterpreters are
involved: Refleaks buildbots failures which prevent to spot other
regressions, and so these "leaks" ... continue reading
#ifndef Py_LIMITED_API
#endif
cpython/fileobject.h
#ifndef Py_CPYTHON_FILEOBJECT_H
# error "this header file must not be included directly"
#endif
why not use #ifndef #define
cpython/fileobject.h
#ifndef Py_CPYTHON_FILEOBJECT_H
#define Py_CPYTHON_FILEOBJECT_H
....
#endif /* Py_CPYTHON_FILEOBJECT_H */
Python eXTensions for VS Code
PyXT is a VS Code extension that adds editor commands implemented in Python. In addition to providing several built-in commands, it also provides an extension point for adding personal/custom commands.
URL: https://github.com/millerdev/pyxt
License: MIT
Installation: PyXT is available on the Visual Studio Marketplace [1] as well as Open VSX Registry [2].
[1] https://marketplace.visualstudio.com/items?itemName=millerdev.pyxt
[2] https://open-vsx.org/extension/mi... continue reading
Hi
Don Knuth, author of The Art Of Computer Programming and creator of the TeX
typesetting system is 83 today. Happy Birthday Don. Thank you for TeX and
everything else.
You're warmly invited to join me online to celebrate Don's life and work.
The virtual party is on Thursday 14 January, 6:30 to 7:30pm UK time.
You'll find the zoom details at (and a goto tribute) at:
https://jfine2358.github.io/post/2021/01/10/happy-birthday-don-knuth/
This link also contains a discussion of how merging two ... continue reading
Hello,
Today I had a quite simple need, I am unsure about the best way to do it,
and saw a possible improvement for the *timeit *module.
I have about 30 Python scripts and I want to measure precisely their
execution times, without measuring the interpreter startup time, because
for most of them it is quite short (<1ms).
I see several ways to do this:
0. Just measure the execution time with "time python script.py"
> Not great for me, because for the fastest scripts, it is very
imprecise.
1... continue reading
We are planning to produce the next security-fix rollup releases for Python 3.7.x and 3.6.x on 2021-01-15. The most recent releases for these versions were on 2020-08-17. There has not been a lot of activity for either branch since then.
Core developers: if you know of any additional security issues that should be addressed in these releases, please mark the relevant bpo issues as "release blocker" and, if possible, submit PRs for review prior to the end of 2021-01-14 AOE.
Thanks!
--
Ned D... continue reading
It was really good to see Python 3.9 adding the topological sort algorithm. What other algorithms might come next to the graphlib module? I think the basic ones like BFS, DFS, Bellman Ford's shortest path algorithm will be quite useful to have. Let me know if contributions are welcome. Thanks!
Howdy howdy. While working on my PEP I stumbled over a lot of behavior by
annotations that I found inconsistent and inconvenient. I think there are
several problems here that needs fixing. This discussion will probably
evolve into a PEP, and I'll be happy to steer that process. But I'm less
certain about what the right thing to do is. (Although I do know what I'd
prefer!) So let's talk about it!
Annotations are represented in Python as a dictionary. They can be present
on functions, cl... continue reading
I've written a new PEP. Please find it below. Happy reading!
//arry/
PEP: XXXX
Title: Deferred Evaluation Of Annotations Using Descriptors
Version: $Revision$
Last-Modified: $Date$
Author: Larry Hastings larry@hastings.org
Discussions-To: Python-Dev python-dev@python.org
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 11-Jan-2021
As of Python 3.9, Python supports two different behaviors
for annotations:
Author: Larry Hastings larry@hastings.org
Is anyone else interested in additional introspection facilities for the
functools.lru_cache?
You can view the cache hit and miss statistics using the cache_info()
method, but you can't see what values actually are in the cache. That
would be useful to me.
I propose a method:
@functools.lru_cache()
def function(arg):
...
function.cache_export()
that returns a dictionary {arg: value} representing the cache. It
wouldn't be the cache itself, just a shallow copy of the c... continue reading
I am delighted to announce the release 2.1.1 of Austin. If you haven't
heard of Austin before, it is an open-source frame stack sampler for
CPython, distributed under the GPLv3 license. It can be used to obtain
statistical profiling data out of a running Python application without a
single line of instrumentation. This means that you can start profiling a
Python application straight away, even while it's running on a production
environment, with minimal impact on performance.
The simplest way o... continue reading
During the development of cpython 3.10, Sphinx was bumped to 3.2.1.
Problem is Sphinx 3 have some incompatibilities with Sphinx 2, some that
we could work around, some are bit harder, so we may need to bump
needs_sphinx = '3.2' (currently it is 1.8).
I found two incompatibilities:
We're using :no-trim-doctest-flags:, introduced in Sphinx 3.2.0, if we
build with Sphinx < 3.2.0 the blocks using it are dropped by Sphinx (we
use it in library/doctest).
double backslashes in domain dire... continue reading
Hi,
I've found myself typing too many time this:
pathlib.Path("some-dir-name").mkdir(parent=True, exist_ok=True)
Wouldn't be better to have a pathlib.Path.makedirs with parent/exist_ok set
to True by default?
Thanks
Hello,
In Modules/main.c, wherever PyImport_ImportModule() is use, the variables
(runpy and sys) are named as follows:
runpy = PyImport_ImportModule("runpy"); // line 265
sys = PyImport_ImportModule("sys"); // line 444
Can we also rename 'mod' to 'readline' for consistency in line 215?
PyObject *mod = PyImport_ImportModule("readline"); // line 215
if (mod == NULL) {
PyErr_Clear();
}
else {
Py_DECREF(mod);
}
Suggested changes:
PyObject *readline = PyImport_ImportModu... continue reading
Hello,
on behalf of the PyInstaller development team I'm happy to announce
PyInstaller 4.2.
http://www.pyinstaller.org <http://www.pyinstaller.org>
Thanks for all those who contributed questions, bug-reports or
pull-requests.
PyInstaller is in urgent need of funding to make future security fixes
happen, seehttps://github.com/pyinstaller/pyinstaller/issues/4404 for
details.
=== Important Changes ===
Release 4.2 adds support for Python 3.8 and 3.9,
is able to fin... continue reading
I often find that python lacks a nice way to say "only pass an argument
under this condition". (See previous python-list email in "Idea: Deferred
Default Arguments?")
Example 1: Defining a list with conditional elements
include_bd = True
current_way = ['a'] + (['b'] if include_bd else [])+['c']+(['d'] if
include_bd else [])
new_way = ['a', 'b' if include_bd, 'c', 'd' if include_bd]
also_new_way = list('a', 'b' if include_bd, 'c', 'd' if include_bd)
Example 2: Deferring to defa... continue reading
A beta release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/5.4b1
This release contains a security fix for CVE-2020-14343. It removes the
python/module, python/object, and python/object/new tags from the
FullLoader.
YAML that uses these tags must be loaded by UnsafeLoader, or a custom loader
that has explicitly enabled them.
This beta release also adds Python wheels for manylinux1 (... continue reading
Hello,
Ruby has following feature. Suppose the existing class "Cls" is scope
(either defined before or imported from some module), then the code
like:
class Cls
def mixin_method(args)
...
end
end
Will "reopen" (Ruby term) that class and will add a new method
"mixin_method" to it.
Syntactically, that's complete madness - the same syntax is used to
both define the class initially and augment it afterwards, and that's
expectedly leads to user confusion, e.g.
https://stackoverflo... continue reading
Wing 7.2.8 fixes reformatting selections for PEP8, corrects completion
of code reformatting in remote files when code is unchanged, fixes
problems analyzing incomplete 'def async' statements, correctly handles
refactor module rename when the target name exists, adds a preference to
control the delay before tooltips are shown, reduces the default
tooltips delay, shows a warning when a file exceeds the configured
maximum size for running external code checkers, and makes a number of
... continue reading
Hi there,
I've spent quite some time on memory profiling for Python now. I'm
struggling to get more information from the allocated memory right now
for what looks like a sad reason. :(
Supposedly PyObject_Malloc() returns some memory space to store a
PyObject. If that was true all the time, that would allow anyone to
introspect the allocated memory and understand why it's being used.
Unfortunately, this is not the case. Objects whose types are tracked by
the GC go through _PyObject_GC_Alloc()... continue reading
Hi,
The /etc/paths.d directory on Mac OS X contains the following
directory. Some packages have their PATH variables set there.
For Python, I have to set the PATH manually in my ~/.bashrc. Should
the Python developers consider setting PATH in /etc/paths.d as well?
==> /etc/paths.d/100-rvictl <==
/Library/Apple/usr/bin
==> /etc/paths.d/40-XQuartz <==
/opt/X11/bin
==> /etc/paths.d/com.vmware.fusion.public <==
/Applications/VMware Fusion.app/Contents/Public
--
Regards,
Peng
Hi
There's interest here in arithmetic operations on NaN . I've just seen a
product listed as costing NaN pounds to buy a null amount. That was written
as £NaN/null.
The bargain item is Glade Shake & Vacuum Citrus, and you can see it at
https://www.tesco.com/groceries/en-GB/products/253732570
Searching on this site for 'NaN' brings up many entries for
https://en.wikipedia.org/wiki/Naan bread.
with best regards
Jonathan
Vulture finds unused code in Python programs. This is useful for
cleaning up and finding errors in large code bases. If you run Vulture
on both your library and test suite you can find untested code.
Due to Python's dynamic nature, static code analyzers like Vulture are
likely to miss some dead code. Also, code that is only called
implicitly may be reported as unused. Nonetheless, Vulture can be a
very helpful tool for higher code quality.
Do... continue reading
ACTIVITY SUMMARY (2021-01-08 - 2021-01-15)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7546 ( -3)
closed 47126 (+71)
total 54672 (+68)
Open issues with patches: 3027
#41837: Upgrade installers to OpenSSL 1.1.1i
https://bugs.python.org/issue41837 reopened by christian.heimes
#42869: pydoc does not append .... continue reading
Announcing the release of Blue version 0.5.1
Some folks like black <https://black.readthedocs.io/en/stable/>_ but I
prefer blue <https://blue.readthedocs.io/en/latest/>_.
blue is a somewhat less uncompromising code formatter than black,
the OG of Python formatters. We love the idea of automatically formatting
Python code, for the same reasons that inspired black, however we take
issue with some of the decisions black makes. Ku... continue reading
Not sure if this is where I should report, but I have a segfault in reportlab userguide creation with 3.10a4. I am
getting this info from coredumpctl running archlinux with
Linux hostname 5.10.6-arch1-1 #1 SMP PREEMPT Sat, 09 Jan 2021 18:22:35 +0000 x86_64 GNU/Linux
the error is
Message: Process 1530711 (python) of user 1000 dumped core.
Stack trace of thread 1530711:
#0 0x00007f7c9bf72615 raise (libc.so.6 + 0x3d615)
#1 0x00007f7c... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/5DCR2R6POCOHTPFUOY4F5G7GTBYX6OPO/)
I've been following along various issues in mypy regarding challenges with
getting the ABCs in numbers
(https://docs.python.org/3/library/numbers.html) working. Currently,
there's a lot of clever logic in the functions int, float, and complex.
Currently, inheriting from Real doesn't give you complex. This is
because the complex function doesn't need it—it falls back to float. I
think it would be nice if it did for the purpose of type annotations.
Best,
Neil
Hi, all.
I want to write type hints without worrying about runtime overhead.
Current best practice is:
from __future__ import annotations
import typing
if typing.TYPE_CHECKING:
import xxx # modules used only in type hints.
But it would be nice if I can avoid importing even "typing" module.
How about adding TYPE_CHECKING builtin that is False?
from __future__ import annotations
if TYPE_CHECKING:
from typing import Any, Optional
# We can use Any, Optional, etc here.
```... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/LS2UZYWX3VHNIMKBGLYEE75N4E7D6CEE/)
Hi,
We are working on upgrading Python from 3.9 to 3.10 in Fedora and we
are facing many Python 3.10 incompatible changes. Most changes were
planned with a deprecation period, but, as usual, projects are not
tested with DeprecationWarning treated as errors, and so tons of
packages now fail to build.
I'm not here to talk about DeprecationWarning, but how we communicate
on incompatible changes made on purpose. For example, What's New in
Python 3.8 announces: "In asyncio, the explicit passing of ... continue reading
Hi everyone,
It's time for yet another PEP :)
Fortunately, this one is a small one that doesn't change much.
It's aim is to make the VM more robust.
This PEP proposes that machine stack overflow is treated differently
from runaway recursion. This would allow programs to set the maximum
recursion depth to fit their needs and provide additional safety guarantees.
The following program will run safely to completion:
sys.setrecursionlimit(1_000_000)
def f(n):
... continue reading
A new release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/5.4
This release contains a security fix for CVE-2020-14343. It removes the
python/module, python/object, and python/object/new tags from the
FullLoader. YAML that uses these tags must be loaded by UnsafeLoader, or a
custom loader that has explicitly enabled them.
This release also adds Python wheels for manylinux1 (x86_64) and Mac... continue reading
Hi,
I've updated the PEP in light of my experiments and feedback.
The new API is simpler and a bit more backwards compatible.
https://www.python.org/dev/peps/pep-0651/
Cheers,
Mark.
A new release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/5.4.1
This release contains a fix for AttributeError during module import in some
mixed version installations.
PyYAML 5.4.1 will be the last release to support Python 2.7 (except for
possible
critical bug fix releases).
An initial release of icontract-hypothesis is now available:
https://github.com/mristin/icontract-hypothesis/releases/tag/v1.0.0
together with IDE integrations:
Icontract-hypothesis combines design-by-contract w... continue reading
Hello,
There's been a bug open where doctest can break if there are proxy
objects that fail to unwrap (https://bugs.python.org/issue35753) since
python 3.7, this includes when importing 'call' from the 'mock' module.
Does someone have time to review PR 22981
(https://github.com/python/cpython/pull/22981).
Last feedback from folks with merge capabilities seems to be from
November 8th. I've replied a few times in December on the PR but there
is no response.
-Alfred
On behalf of the SC, I'm happy to announce that we have chosen to accept
PEP 632. Congrats, Steve, and thanks for the work on the PEP!
I'll let Steve outline what the next steps are for implementing the PEP.
Hello,
I am pleased to announce the release of django-saml2-auth, which includes
71 commits, 92 lines of commit messages and 3 separate reviews and
reviewers.
The project is originally developed by Li Fang https://github.com/fangli,
but is forked and currently maintained by Mostafa Moradian <
https://github.com/mostafa> and sponsored by Load Impact AB (https://k6.io).
This release is backward incompatible with older versions: 1.x.x and 2.x.x,
and includes heavy refactoring, impro... continue reading
ACTIVITY SUMMARY (2021-01-15 - 2021-01-22)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7578 (+32)
closed 47161 (+35)
total 54739 (+67)
Open issues with patches: 3037
#42604: EXT_SUFFIX too short on FreeBSD and AIX
https://bugs.python.org/issue42604 reopened by vstinner
#42937: 192.0.0.8 (IPv4 dummy addres... continue reading
Hi, all.
I am rewriting PEP 597 to introduce a new EncodingWarning, which
subclass of DeprecationWarning and used to warn about future default
encoding change.
But I don't think we can change the default encoding of
io.TextIOWrapper and built-in open() anytime soon. It is
disruptive change. It may take 10 or more years.
To ease the pain caused by "default encoding is not UTF-8 (almost)
only on Windows" (*), I came up with another idea. This idea is not
mutually exclusive with PEP 597, but ... continue reading
On behalf of the PyPA, I am pleased to announce that we have just released pip 21.0, a new version of pip. You can install it by running python -m pip install --upgrade pip.
This is the first scheduled release of pip in 2021, following our regular quarterly release schedule.
--
*Life is short .... Live it to it's full potential :) -Swati *
I've created a helper class in my own library that enhances the
existing dataclass:
a) init accepts keyword-only arguments,
b) Optional[...] attribute without a specified default value would
default to None in init.
I think this could be useful in stdlib. I'm thinking a dataclass
decorator parameter like "init_kwonly" (default=False to provide
backward compatibility) that if True would implement this behavior.
Thoughts?
My previous thread is hijacked about "auto guessing" idea, so I split
this thread for pathlib.
Path.open() was added in Python 3.4. Path.read_text() and
Path.write_text() was added in Python 3.5.
Their history is shorter than built-in open(). Changing its default
encoding should be easier than built-in open and TextIOWrapper.
New default encodings are:
Hi,
I just added a new sys.module_names attribute, list (technically a
frozenset) of all stdlib module names:
https://bugs.python.org/issue42955
There are multiple use cases:
Hi,
PEP 558 seems to be dormant, if not abandoned.
There are at least two open issues for bugs resulting from the currently
weird and inefficient behavior of f_locals and locals().
See https://bugs.python.org/issue30744 for an example of undesirable
behaviour.
PEP 588, or something like it, would fix those.
I'd be happy to take over the PEP, or write a new one.
I like PEP 588, although I would propose a simplification.
The PEP mentions "tracing mode" and changes behavior according to ... continue reading
pytest 6.2.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
Sorry for posting multiple threads so quickly.
Microsoft provides UTF-8 code page for process. It can be enabled by
manifest file.
https://docs.microsoft.com/ja-jp/windows/uwp/design/globalizing/use-utf8-code-page
How about providing Python binaris both of "UTF-8 version" and "ANSI version"?
This idea can provide a more smooth transition of the default encoding.
Sorry for posting multiple threads so quickly.
Microsoft provides UTF-8 code page for process. It can be enabled by
manifest file.
https://docs.microsoft.com/ja-jp/windows/uwp/design/globalizing/use-utf8-code-page
How about providing Python binaris both of "UTF-8 version" and "ANSI version"?
This idea can provide a more smooth transition of the default encoding.
Hi everyone,
Are C structs part of the C-API if the struct is only included in a
header, but not documented?
I have always assumed not, but it isn't clear.
This question arose in https://github.com/python/cpython/pull/24298
Obviously, any structs listed in
https://docs.python.org/3/c-api/structures.html are part of the API
Thoughts?
Cheers,
Mark.
pyclbr is the stdlib module browser (once just class browser, hence the
name). The doc
https://docs.python.org/3/library/pyclbr.html#module-pyclbr, which I
revised in 2017, documents readline and readline_ex as the public call
interface. The functions return a hierarchical structure that includes
Function and Class instances. (Both subclass pyclbr._Object.) The doc
I revised already omitted signatures for these classes and just listed
the attributes of instances. Just before that list... continue reading
The fact that Python does not use UTF-8 as the default encoding when
opening text files is an obstacle for many Windows users, especially
beginners in programming.
If you search for UnicodeDecodeError, you will see that many Windows
users have encountered the problem.
This list is only part of many search results.
We're happy to announce the pre-launch website for this year's
EuroPython 2021:
* EuroPython 2021 *
https://ep2021.europython.eu/
The site comes with an FAQ page, which lists all the information we have
for you at the moment. We're repeating the most important part here:
EuroPython 2021 will be held online from July 26 - August 1, 2021,
using the following structure:
Hi Nick,
Regarding f_locals PEP 558 states:
"""
Instead of being a direct reference to the internal dynamic snapshot
used to populate the independent snapshots returned by locals(),
frame.f_locals will be updated to instead return a dedicated proxy type
(implemented as a private subclass of the existing
types.MappingProxyType) that has two internal attributes not exposed as
part of the Python runtime API:
Hi everyone,
PEP 7 says that C code should conform to C89 with a subset of C99 allowed.
It's 2021 and all the major compilers support C11 (ignoring the optional
parts).
C11 has support for thread locals, static asserts, and anonymous structs
and unions. All useful features.
Is there a good reason not to start using C11 now?
Cheers,
Mark.
Hi folks,
I've had an open PR for a few weeks that still needs a review:
https://github.com/python/cpython/pull/24001
This PR fixes a shutil.move() bug when permission to a directory is denied.
Thanks,
Winson
Hello,
I'm Francis, a beginner programmer from Ghana, West Africa.
I was wondering why the list .index() method doesn't return negative
indices as well as well as positive indices.
Although ambiguity will make it difficult to implement, in certain cases,
it would be useful if it could return the negative index.
For instance, if one creates an if statement that checks whether an element
is the last item in a list as follows:
listy = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
if listy.index(10) == -1:
... continue reading
ACTIVITY SUMMARY (2021-01-22 - 2021-01-29)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7588 (+10)
closed 47211 (+50)
total 54799 (+60)
Open issues with patches: 3032
#33387: Simplify bytecodes for try-finally, try-except and with blocks
https://bugs.python.org/issue33387 reopened by iritkatriel
#36675: Do... continue reading
Currently, python allows variable documentation via PEP 526
https://www.python.org/dev/peps/pep-0526/. For most functions with short
parameter lists that can fit in a reasonable column limit, I prefer the
traditional declaration style with Google-style doc strings:
*def connect_to_next_port(self, minimum: int) => int: *
"""Connects to the next available port.
Args:
minimum: A port value greater or equal to 1024.
Returns:
The new minimum port.
Raises:
... continue reading
Hi Nick,
A couple more issues with PEP 558, as I see it.
There is no specification section in PEP 558.
Much of PEP 558 describes the differences between the current behavior
and what PEP 558 proposes. These differences are often intermingled with
a discussion of the flaws with the current behavior, which makes it
difficult to understand what the proposed behavior is.
I could not implement PEP 558 from the PEP alone.
Cycles and the cost of ma... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.20.0rc2. This NumPy release is the largest to date, containing some 684
merged pull requests contributed by 184 people. See the list of highlights
below. The Python versions supported for this release are 3.7-3.9, support
for Python 3.6 has been dropped. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.20.0/; source archives, release notes,
and wheel hashes are available on Github
<... continue reading
I'm still messing around with my register VM stuff (off-and-on). I'm
trying to adjust to some changes made a while ago, particularly (but
probably not exclusively) after RERAISE acquired an argument. As a
result, at least the expected_opinfo_jumpy list changed in a
substantial way. I can manually work my way through it, but it sorta
seems like someone might have used a script to translate the output of
dis.dis(jumpy) into this list. Am I mistaken about this?
Thx,
Skip
Hi, all.
I updated the PEP 597 yesterday.
Please review it to move it forward.
PEP: https://www.python.org/dev/peps/pep-0597/
Previous thread: https://discuss.python.org/t/3880
Main difference from the previous version:
Add a new warning category EncodingWarning. It is emitted when
encoding option is omitted and the default encoding is a locale
... continue reading
Hi,
I'm trying to understand the purpose of the check in tp_new_wrapper() of
typeobject.c that results in the "is not safe" exception.
I have the following class hierarchy...
B -> A -> object
...where B and A are implemented in C. Class A has an implementation of
tp_new which does a few context-specific checks before calling
PyBaseObject_Type.tp_new() directly to actually create the object. This
works fine.
However I want to allow class B to be used with a Python mixin. A's
tp_new() th... continue reading
Hi everyone,
I am prepared to start the release process for Python 3.10 a5 but there are
several
issues marked as release blockers that affect 3.10:
Although release blockers mainly apply to important releases, there are two
are security issues and some
of the rest involve changes in bytecode or the tracing mac... continue reading
Hi all,
I would like to request feedback by python-dev on the current
implementation of PEP 637 - Support for indexing with keyword
arguments.
https://www.python.org/dev/peps/pep-0637/
The PEP is ready for SC submission and it has a prototype
implementation ready, available here (note, not reviewed, but
apparently fully functional)
https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
(note: not sure if there's a preference for the link to be to t... continue reading
The discussion around PEP 649 got me thinking about what I believe is the
largest downside to PEP 563: the inability to evaluate annotations created
with closures. While this is in general unavoidable, if the type is ever
referenced in an annotated function (including as an annotation) it should
be resolvable via __closure__.
For example:
from __future__ import annotations
import typing
def gen(T):
def f(x: T):
y: T = ...
return f
f = gen(int)
nonlocal_vars = {
var : ... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/L2XH2EIFCEPT5DQRPRFR6WYEM6M2LM2V/)
Well, this one took a bit more time due to some surprise last time
reference leaks and release blockers to fix, but now Python 3.10.0a5 it’s
here. Will this be the first release announcement of the 3.10 series
without copy-paste typos? Go get it here:
https://www.python.org/downloads/release/python-3100a5/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This release, 3.10.0a5 is the fifth of
seven planned alpha releases. Alpha releases a... continue reading
Well, this one took a bit more time due to some surprise last time
reference leaks and release blockers to fix, but now Python 3.10.0a5 it’s
here. Will this be the first release announcement of the 3.10 series
without copy-paste typos? Go get it here:
https://www.python.org/downloads/release/python-3100a5/
Major new features of the 3.10 series, compared to 3.9
Python 3.10 is still in development. This release, 3.10.0a5 is the fifth of
seven planned alpha releases. Alpha releases are intende... continue reading
Hi Larry,
Can you give us a status update for your PEP 649? I don't recall reading
anything about it in the past few weeks. I am super excited about this
solution to the problem (even if there are a few issues to work through)
and I think it will provide better backwards compatibility than the current
plan for Python 3.10 (PEP 563, from future import annotations, causing
all annotations to be stringified).
If we don't get this into 3.10, we'd have a much more complicated
transition. There ... continue reading
There's a long ongoing thread with the subject "Make UTF-8 mode more
accessible for Windows users."
There are two obvious problems with UTF-8 mode. First, it applies to entire
installations, or at least entire running scripts, including all imported
libraries no matter who wrote them, etc., making it a blunt instrument.
Second, the problem on Windows isn't that Python happens to use the wrong
default encoding, it's that multiple encodings coexist, and you really do
have to think each time you e... continue reading
Hello,
Everyone knows how hard to find a compelling usecase for the assignment
expression operator (":=", colloquially "walrus operator").
https://www.python.org/dev/peps/pep-0572/ examples never felt
compelling and we all remember the split it caused.
I finally found a usecase where not using assignment expression is
much worse than using it. I'm working on SSA (Static Single
Assignment,
https://en.wikipedia.org/wiki/Static_single_assignment_form) conversion
of Python programs, where ther... continue reading
Hello,
Everyone knows how hard to find a compelling usecase for the assignment
expression operator (":=", colloquially "walrus operator").
https://www.python.org/dev/peps/pep-0572/ examples never felt
compelling and we all remember the split it caused.
I finally found a usecase where not using assignment expression is
much worse than using it. I'm working on SSA (Static Single
Assignment,
https://en.wikipedia.org/wiki/Static_single_assignment_form) conversion
of Python programs, where ther... continue reading
I have seen a lot of interest in this topic, and I think the sheer number
of different lazy import implementations (generally using proxy objects for
modules and then loading them when an attribute is accessed) should present
pretty good evidence that this is a very desired feature, particularly for
writers of library code seeking to optimize start-up times and similar.
Unfortunately, all of these implementations have serious limitations in
that often static code analysis tools cannot understan... continue reading
ACTIVITY SUMMARY (2021-01-29 - 2021-02-05)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7379 (-209)
closed 47495 (+284)
total 54874 (+75)
Open issues with patches: 2926
#16202: sys.path[0] security issues
https://bugs.python.org/issue16202 reopened by christian.heimes
#24275: lookdict_* give up too soon
ht... continue reading
I am pleased to announce Plumage (Plumage-py) 1.4.0 ("Experiment IV").
Plumage is a module to obtain trademark status and information from the
United States Patent & Trademark Office's (USPTO's) Trademark Status &
Document Retrieval (TSDR) system. It takes as input either a trademark
registration number or application serial number, fetches the
corresponding XML data from the PTO's TSDR website, and returns a
dictionary of data associated with the specified TSDR entry.
Example:
from Plumage ... continue reading
Hi all,
Deno is JavaScript runtime that has very nice feature like Top Level Await, I think it would be also nice to have such feature in Python, it will make using async/await more convenient
What do you think ? Share your ideas lets discuss ...
Hi,
Since a decision on PEP 634 is imminent, I'd like to reiterate some
concerns that I voiced last year.
I am worried about the semantics and implementation of PEP 634.
I don't want to comment on the merits of pattern matching in general, or
the proposed syntax in PEP 634 (or PEP 640 or PEP 642).
This is in contrast to almost all of the the rest of the langu... continue reading
Reading the latest discussion about PEP 622/634-636 on the Python Dev mailing list, I've noticed there appears to be confusion about what __future__ imports are supposed to be used for. Multiple people in that thread (and probably elsewhere in one of the many many threads about these PEPs) have suggested including pattern matching as a "provisional" or "experimental" feature that is enabled by an import from __future__.
I don't want to discuss whether __future__ is the correct place for... continue reading
I'm encountering a situation where it would be far cleaner to use
**kwargs (multiple functions taking the same set of parameters); I'd
like to have type hints, and avoid repeating multiple function
definitions, explicitly enumerating all parameters for each function
definition.
Therefore, I'd like to have some meaningful type hint for **kwargs.
First, I thought TypedDict would be a great fit, until I found this
passage in PEP 589:
These features were left out from this PEP, but they are pot... continue reading
I see many people who have their project something like this:
directory/
some_module.py
main.py
and in main.py they do
from some_module import some_function
while they have a library named some_module that is installed from pip, and they can't figure out why Python says that there is no such function.
I would recommend adding a warning like "ImportWarning: The same module exists in this folder and site-packages a well."
so people won't be confused why this function ... continue reading
PyCA cryptography 3.3.2 and 3.4 have been released to PyPI.
cryptography includes both high level recipes and low level interfaces
to common cryptographic algorithms such as symmetric ciphers,
asymmetric algorithms, message digests, X509, key derivation
functions, and much more.
3.3.2 supports Python 2.7, Python 3.6+, and PyPy, while 3.4 supports
Python 3.6+ (including PyPy3).
3.3.2 Changelog (https://cryptography.io/en/latest/changelog.html#v3-3-2):
Hi Python Dev team,
I submitted a PR https://github.com/python/cpython/pull/23736 two months ago.
The PR, which fixes an issue https://bugs.python.org/issue41928 in ZipFile, is "awaiting core review".
Best regards.
Andrea Giudiceandrea
PyCA cryptography 3.4.1 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more.
We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-4-1):
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.20.1. NumPy 1.20.1 is a rapid bugfix release fixing several bugs and
regressions reported after the 1.20.0 release. The Python versions
supported for this release are 3.7-3.9. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.20.1/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.20.1. Linux users will
need pip... continue reading
Pattern matching re-surfaced on my radar today, along with the impression of a conclusion being just around the corner. Although this has seemed an ongoing state at times, a certain finality would come from a steering council decision. At the same time, it seems the polarisation that has developed around this feature has solidified more than dissipated. So I am prompted to throw my hat in the ring of language design.
However, I must acknowledge that it is very late in the development cycle of t... continue reading
In both python 3.7 and 3.8, typing.NamedTuple had some strange behaviour
regarding multiple inheritance. This behaviour was solved in 3.9
(bpo-36517), but this fix also barred me from a feature very close to my
heart: the generic named tuple
T = TypeVar('T')
class LLNode(NamedTuple, Generic[T]):
value: T
next: Optional[LLNode[T]]
bpo-36517 was committed because any additional features of other classes
would be missing from the NamedTuple class at runtime. But Generic has no
feature... continue reading
I raise https://bugs.python.org/issue43156 that suggests that
new users on windows would be less confused if the name of the
installation program did not seem to imply it was the python program.
In a nutshell the proposal is to change from this:
python-3.10.0a5.exe
python-3.10.0a5-amd64.exe
to this (thanks to Matthew Barnett for the improved names:
python-3.10.0a5-win32-setup.exe
python-3.10.0a5-win64-setup.exe
Barry
After much deliberation, the Python Steering Council is happy to announce that we have chosen to accept PEP 634, and its companion PEPs 635 and 636, collectively known as the Pattern Matching PEPs. We acknowledge that Pattern Matching is an extensive change to Python and that reaching consensus across the entire community is close to impossible. Different people have reservations or concerns around different aspects of the semantics and the syntax (as does the Steering Council). In spite of thi... continue reading
Please, consider class(obj) to return obj.class
consistenly with dir(), vars(), repr(), str(),…
class c: pass
o = c()
o.class
<class 'main.c'>
class(o)
File "<stdin>", line 1
class(o)
^
SyntaxError: invalid syntax
H.
Hi everywhere.
I decided to figure out why it is impossible to change methods of built-in types and found
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) {
PyErr_Format(
PyExc_TypeError,
"can't set attributes of built-in/extension type '%s'",
type->tp_name);
return -1;
}
in function type_setattro.
If comment this line and try to patch method eq on the list for example the code will work as expected
Test:
with patch("buil... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/FYS52CPAN7EMSQF4WF3WM5VNO52TBOIT/)
Hello,
I submitted https://bugs.python.org/issue42819 a little over a month ago with an accompanying PR: https://github.com/python/cpython/pull/24108.
Would it be possible to get feedback on it? This addresses a bug that occurs when Python is compiled with the most recent release of GNU Readline and affects both Linux and macOS.
Thanks,
Dustin
Hi all,
What's the recommended approach with issues like https://bugs.python.org/issue43094? Change the docs or the implementation? I did a quick search on bpo, but could not find similar past issues.
Erlend
Hello,
Pycopy is a minimalist, lightweight, resource-efficient implementation
of Python(-like) language. Pycopy to CPython is a similar thing as
Scheme to Common Lisp. Executable sizes of 300-400KB, instant startup,
no need to carry around large monolithic library consisting largely of
legacy modules - are some but not all of Pycopy's features.
Project page: https://github.com/pfalcon/pycopy
Now has website too: https://pycopy.github.io/
The 3.5 releases implement lightweight import hooking ... continue reading
I think we have reached consensus on PEP 647 in typing-sig. We have
implementations for mypy and pyright, not sure about the rest. This PEP
does not affect CPython directly except for the addition of one special
item (TypeGuard) to typing.py -- it would be nice to get that in the 3.10
stdlib.
I'm CC'ing python-dev here to see if there are any further comments; if
not, we can initiate the approval process by creating an issue at
https://github.com/python/steering-council.
--
--Guido van Rossum... continue reading
I raised https://bugs.python.org/issue43155 for the missing
PyCMethod_New that was added in 3.9 but is missing from the
python3.lib.
Barry
def closset_mtach(check, arr, itr):
id_min = []
for ii in range(itr):
id_min_tmp = np.argmin( abs(arr - check) )
id_min.append(id_min_tmp)
arr[id_min_tmp] = float('-inf')
id_min = np.array(id_min)
return id_min
def get_CS_id(arr1, arr2, tol, itr):
tt = arr2
for ii in range(5,6):
id_com = np.where( abs(arr1[ii] - tt) < tol )[0]
if np.size(id_com) >= itr:
mm = closset_mtach(arr1[ii], tt[id_com], itr)
... continue reading
Hi all,
Lambdas can be defined as such:
w = lambda: [12]
x = lambda y: len(y)
I'd like to propose the following:
w = (): [12]
x = (y): len(y)
Or even another contraction for when there are no arguments:
w =: [12]
This would also be consistent with the other proposal on anonymous
functions for defaults:
https://mail.python.org/pipermail/python-list/2021-February/900795.html
--
∞
One of my students gave me an interesting question about why filter and map do not return a reusable function in case the iterable is not passed.
With the current design
In [1]: a = filter(lambda x: x > 60)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-ad0178d4fce0> in <module>
----> 1 a = filter(lambda x: x > 60)
TypeError: filter expected 2 arguments, got 1
... continue reading
Hello,
I'm the primary maintainer of CPython packages in Gentoo. I would like
to discuss possible improvement to the release process in order to
accelerate releasing security fixes to users.
I feel that vulnerability fixes do not make it to end users fast enough.
For example, according to the current release schedules for 3.9 and 3.8,
the bugfix releases are planned two months apart. While the release is
expected to happen in the next few days, both versions are known to be
vulnerable for alm... continue reading
Announcing the release of Blue version 0.6.0!
Preserve the whitespace before the hash mark for right hanging
comments. (GH#20)
Support multiple config files: pyproject.toml, setup.cfg, tox.ini, and .blue
(GH#30)
Fixed blue --version (GH#32)
Added tests!
Some folks like black <https://black.readthedocs.io/en/stable/>_ but I
prefer blue <https://blue.readthedocs.io/en/latest/>_.
blue is ... continue reading
ACTIVITY SUMMARY (2021-02-05 - 2021-02-12)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7415 (+36)
closed 47529 (+34)
total 54944 (+70)
Open issues with patches: 2944
#41754: Webbrowser Module Cannot Find xdg-settings on OSX
https://bugs.python.org/issue41754 reopened by serhiy.storchaka
#43139: test_ttk t... continue reading
What would it take to create an ANSI, ECMA and/or ISO standard for Python?
It seems to have really helped C.
It looks like Java isn't standardized, and it's done OK, though perhaps it
was healthier in the past - before Oracle decided API's were ownable.
I think standardizing Python might be really good for controlling its
growth and avoiding featuritis.
I will explain it in the following few lines of code..
name = "George"
year = 2021
d = {"name": "Mike", "year": 1919}
match d:
case {"name": name, "year": 1917}:
print("match 1 found”)
# I want to remove binding "name" here from partial matching
case {"year": year, "name": "Michael”}:
print("match 2 found”)
# I want to remove binding "year" here from partial matching.
# Basically removing all name bindings after every partial/failed matching
case _:
print("match not fou... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/HOFNVZ6KJA6SHCE4NCLPSK27XLDMK7VR/)
Hello,
Some time ago I posted a query regarding how the simplest possible
(while still practical to use) import hooking might look like. Since
then, I've coded up my try: https://github.com/pfalcon/python-imphook .
I'd be interested in hearing any criticism, in particular in regard to
the claims of minimalism and being "dead simple". Below is the copy of
README for your reference (documentation is still WIP). A few initial
examples are available in the git repo above.
imphook - Simple and c... continue reading
Hello,
On Fri, 12 Feb 2021 18:26:53 +1100
Chris Angelico rosuav@gmail.com wrote:
On Fri, Feb 12, 2021 Paul Sokolovsky pmiscml@gmail.com wrote:
... And on the 2nd thought, that won't work. The reason it works in
JS is that it doesn't have tuples. In Python, "(a, b) => (1, 2)"
means "compare a tuple for greater-or-equal".Should be safe actually - "=>" is not a valid comparison operator.
To punish myself for making such stupid mistakes, I volunteered to
implement PoC of... continue reading
On behalf of the Nikola team, I am pleased to announce the immediate
availability of Nikola v8.1.3. This release has some minor fixes, and
a minor dependency change.
Nikola is a static site and blog generator, written in Python.
It can use Mako and Jinja2 templates, and input in many popular markup
formats, such as reStructuredText and Markdown — and can even turn
Jupyter Notebooks into blog posts! It also supports image galleries,
and is multilingual. Nikola is... continue reading
PyCA cryptography 3.4.5 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-4-5):
I'm happy to announce the release of Pygments 2.8. Pygments is a
generic syntax highlighter written in Python.
Pygments 2.8 provides new lexers, various improvements to existing
lexers and some small styling tweaks. It also introduces significant
changes to the test infrastructure to make contributions easier and
improve the overall quality. Please have a look at the changelog
https://pygments.org/docs/changelog/.
Report bugs and feature requests in the issue tracker:
<https://github.com... continue reading
In some functional programming languages, they can pattern match a function based on its parameters. Similar to function overloading. Will Python Pattern Matching do something similar to functions?
If calling a function doesn't match any of the cases and catch-all case is not present, then some sort of new or exisiting Exception needs to be raised.
Type annotations can be used (for the parameters, they may be redundant, but for the return, they can be useful). The Return annotation comes righ... continue reading
I am updating PEP 597 to include discussions in the thread.
Before finishing the PEP, I need to decide the option name.
I used PYTHONWARNDEFAULTENCODING (envvar name) /
warn_default_encoding (-X option and sys.flags name) before, but it
seems too long and hard to type, easy to misspell.
Currently, I use PYTHONWARNENCODING / warn_encoding, but it is not so explicit.
Which name is the best balance between explicitness and readability?
Hello,
I hope you are all well, I currently have an issue / merge request that has
become stale and as per the guidelines I am sending this e-mail to request
someone to review it for me please.
Issue Number: 42861 (https://bugs.python.org/issue42861)
Pull Request: 24180 (https://github.com/python/cpython/pull/24180)
This is my first contribution to CPython and I am very keen to get this
added as I think it is an almost essential enhancement missing from the
ipaddress module. I would greatly ... continue reading
Hi All,
The pathlib library is really helpful when working with paths, but creating an instance of Path class could be easier.
There was a discussion about solving this with p-strings here https://mail.python.org/archives/list/python-ideas@python.org/thread/MNKRQF3ZM77A224EO5OZLLAUFGB5MTVA/#OH4ANXJTTTKONQ4FRWDTEW2FEZVSKLZV
But that would alter python syntax.
Easier, but just as nice solution could be adding the following snippet to pathlib:
class PathLiteral():
def truediv(self, other)... continue reading
Python 3.7.10 and 3.6.13, the lastest security fix rollups for Python 3.7 and Python 3.6, are now available. You can find the release files, links to the changelogs, and more information here:
https://www.python.org/downloads/release/python-3710/
https://www.python.org/downloads/release/python-3613/
These releases are source code only; Windows and macOS binary installers are not provided for security fix releases.
Note that Python 3.9 is now the latest feature release series of Python... continue reading
Python 3.7.10 and 3.6.13, the lastest security fix rollups for Python 3.7 and Python 3.6, are now available. You can find the release files, links to the changelogs, and more information here:
https://www.python.org/downloads/release/python-3710/
https://www.python.org/downloads/release/python-3613/
These releases are source code only; Windows and macOS binary installers are not provided for security fix releases.
Note that Python 3.9 is now the latest feature release series of Python... continue reading
A note to webmaster@python.org from an astute user named Hiromi in
Japan* referred
us to Guido's shell archives for the 0.9.1 release from 1991. As that
wasn't listed in the historical releases README file:
https://legacy.python.org/download/releases/src/README
I pulled the shar files (and a patch), then made a few tweaks to get it to
build:
% ./python
print 'hello world!'
hello world!
import sys
dir(sys)
['argv', 'exit', 'modules', 'path', 'ps1', 'ps2', 'stderr', 'stdin',
'stdout... continue reading
PyCA cryptography 3.4.6 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-4-6):
-Paul Kehrer (reaperhulk)
I’m happy to announce two release candidates today: Python 3.9.2rc1, and Python 3.8.8rc1. Get them from:
https://www.python.org/downloads/release/python-392rc1/ https://www.python.org/downloads/release/python-392rc1/
https://www.python.org/downloads/release/python-388rc1/ https://www.python.org/downloads/release/python-388rc1/
Unless critical issues are discovered, both release candidates will become their respective final versions on Monday, March 1st.
Following that, the last full regul... continue reading
I’m happy to announce two release candidates today: Python 3.9.2rc1, and Python 3.8.8rc1. Get them from:
https://www.python.org/downloads/release/python-392rc1/ https://www.python.org/downloads/release/python-392rc1/
https://www.python.org/downloads/release/python-388rc1/ https://www.python.org/downloads/release/python-388rc1/
Unless critical issues are discovered, both release candidates will become their respective final versions on Monday, March 1st.
Following that, the last ful... continue reading
Starting this as a new thread for the interested reader:
On 17.02.21 11:18, Chris Angelico wrote:
On Wed, Feb 17, 2021 at 9:11 PM Sven R. Kunze srkunze@mail.de wrote:
Still think that "object()" should be writable since this seems like an
arbitrary restriction (+SimpleNamespace is no builtin and at least I
would use object() for fast PoCs or dirty hackery). But I guess there's
been discussion around this already.
[...]
Using SimpleNamespace is the best way to do this, and ... continue reading
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.6.1, which is a bug fix release.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.6.1
One of a few ways to install this release with pip:
pip install scipy==1.6.1
SciPy 1.6.1 is a bug-fix release with no new features
compared to 1... continue reading
The EuroPython 2021 organization is starting and we're looking for more
help with running the conference.
* EuroPython 2021 *
https://ep2021.europython.eu/
For EP2021, we are using a slightly different approach compared to
previous years:
All new volunteers will first join the Plaza – our central
get-together place for all team members – and only later enter the
various work groups (WGs) we have for running the conference.
Additionally, we wil... continue reading
Hi everyone,
I’m happy to announce the release of structlog 21.1.0.
With almost a million downloads per month, structlog is the most popular solution for structured logging in Python. It doesn’t just allow you to log key-value pairs in a structured manner, it also makes it EASIER and FASTER. Check out https://www.structlog.org/en/stable/why.html if you’re intrigued but not convinced!
Heartfelt thanks go to my generous GitHub sponsors https://github.com/sponsors/hynek, companies subscribin... continue reading
Hi everyone,
I'd like to announce a new PEP.
https://www.python.org/dev/peps/pep-0653/
It builds on PEP 634 (Structural Pattern Matching: Specification), adding:
More precise semantics.
A bit more customization for complex classes.
Its also a bit more robust and should be faster (eventually).
The syntax is unchanged, and in most cases the semantics are the same.
As always, comments and suggestions are welcome.
Cheers,
Mark.
<DISCLAIMER>I am not a Python core developer, but my question relates
to changes that are expected in Python 3.10, so I felt this was the
best forum to ask. Please let me know if I should discuss this
elsewhere or file a documentation bug.</DISCLAIMER>
First of all, thank you Yuri Selivanov and everybody who contributed
to the overhaul of the asyncio docs which are now much better
organized.
In the process of updating "Fluent Python" to cover Python 3.9, I
learned that the "Generator-based cor... continue reading
Hello,
python-compiler is a project to port Python2's stdlib "compiler"
package (https://docs.python.org/2.7/library/compiler.html) to Python3.
Initial porting work and support of CPython3.5 constructs/bytecode was
done me. Around the Christmas time last year, there was a patch from
some Facebook people which upgraded it to CPython3.7
constructs/wordcode and added some missing parts (e.g. peephole
optimizer). I also asked them if they'd like to handle further
maintenance of the projects, and ye... continue reading
Convinced of the wonders of free two-day deliveries, I’m pleased to present you Python 3.9.2 and 3.8.8. Get them from:
https://www.python.org/downloads/release/python-392/ https://www.python.org/downloads/release/python-392/
https://www.python.org/downloads/release/python-388/ https://www.python.org/downloads/release/python-388/
Next up, the last full regular maintenance release of Python 3.8 is planned for May 3rd 2021, after which it will shift to source releases only for security bug f... continue reading
Convinced of the wonders of free two-day deliveries, I’m pleased to present you Python 3.9.2 and 3.8.8. Get them from:
https://www.python.org/downloads/release/python-392/ https://www.python.org/downloads/release/python-392/
https://www.python.org/downloads/release/python-388/ https://www.python.org/downloads/release/python-388/
Next up, the last full regular maintenance release of Python 3.8 is planned for May 3rd 2021, after which it will shift to source releases only for security... continue reading
ACTIVITY SUMMARY (2021-02-12 - 2021-02-19)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7428 (+13)
closed 47578 (+49)
total 55006 (+62)
Open issues with patches: 2943
#37146: opcode cache for LOAD_GLOBAL emits false alarm in memory leak
https://bugs.python.org/issue37146 reopened by vstinner
#42990: Impro... continue reading
Imagine specifying multiple same types. Awful.
from typing import Tuple
def time() -> Tuple[int, int, int, int, int, int, int, str]:
""" Return (year, month, day, hour, minute, second, millisecond, timezone name).
...
So I suggest a new syntax, Seq[type * times], to solve this problem:
from typing import Tuple
def time() -> Tuple[int * 7, str]:
...
It's short notice, but PyCascades is hosting sprints on Sunday, Feb. 21
from 09:00 - 12:30 PST tomorrow and the organizers wanted to see if anyone
happened to be up for leading or helping out anyone who wants to sprint on
CPython.
I guess we forgot to observe it yesterday, but: February 19, 1991, was
the day Guido first posted Python 0.9.1 to alt.sources:
https://groups.google.com/g/alt.sources/c/O2ZSq7DiOwM/m/gcJTvCA27lMJ
Happy 30th birthday, Python!
//arry/
I think perhaps we should admit that this build system is no longer supported. From everything I can tell, the mingw project is no longer maintained. The project's site, mingw.org, is no longer live; the project on sourceforge, although still downloaded daily, had its last commit almost 3 years ago - a commit which changed the official project URI to a new link that now is also dead.
Looking over BPO there are a little over 50 bugs open against mingw, but only 7 that have any meaningful activit... continue reading
Hi,
I propose to actively remove support for legacy platforms and
architectures which are not supported by Python according to PEP 11
rules: hardware no longer sold and end-of-life operating systems. The
removal should be discussed on a case by case basis, but I would like
to get an agreement on the overall idea first. Hobbyists wanting to
support these platforms/archs can continue to support them with
patches maintained outside Python. For example, I consider that the
16-bit m68k architectur... continue reading
Hello,
Here's example:
Traceback (most recent call last):
File "pseudoc_tool.py", line 91, in <module>
first_class_function_value(func, **pass_params)
TypeError: print() got an unexpected keyword argument 'noann'
Ok, which "print" do you mean, dear CPython? I have a dozen of print
functions (mostly methods) around. So I now need to reduce to printf
debugging to find which one is actually meant. And what if that happens
in 3rd-party library installed in /usr/lib? On a production system?... continue reading
Hello,
Here's example:
Traceback (most recent call last):
File "pseudoc_tool.py", line 91, in <module>
first_class_function_value(func, **pass_params)
TypeError: print() got an unexpected keyword argument 'noann'
Ok, which "print" do you mean, dear CPython? I have a dozen of print
functions (mostly methods) around. So I now need to reduce to printf
debugging to find which one is actually meant. And what if that happens
in 3rd-party library installed in /usr/lib? On a production system?... continue reading
Author: Irit Katriel iritkatriel@gmail.com, Yury Selivanov yury@edgedb.com, Guido van Rossum guido@python.org
Hello!
I'm pleased to announce version 3.2.6.post1, the 1st post-release
for release 3.2.6 of branch 3.2 of CheetahTemplate3.
Improvement and refactoring in CI and tests with tox.
There were no changes in the main code, there is no need to upgrade
unless you gonna run tests.
The contributors for this release are
Andrew J. Hesford and Victor Stinner.
Many thanks!
This is the first release that provide binary wheels for Python... continue reading
Hello everybody,
After a while, I would like you to be informed about my current
(python++) project:
https://nhi1.selfhost.co/wiki/index.php?title=NHI1_-_the_POWER_of_programming
==========================================================================
VISION
It is difficult to describe the POWER of NHI1 in a few simple words -
let me try:
NHI1 - something that writes code for you
The Something is a collection of tools, libraries, and design pa... continue reading
Currently ~False is -1 and ~True is -2. Would be nicer if ~bool was the
same as not bool. Hopefully nobody actually relies on this but
nevertheless, it would be a backwards-incompatible change so the whole
deprecation warnings and whatnot would be required.
In particular, this is nice for xnor operator: a ^~ b. This currently
works on ints, but not on bools, while most other operators, including
xor, do successfully work on bools.
Hi all,
We would like to request feedback on PEP 654 -- Exception Groups and
except*.
https://www.python.org/dev/peps/pep-0654/
It proposes language extensions that allow programs to raise and handle
multiple unrelated
exceptions simultaneously, motivated by the needs of asyncio and other
concurrency libraries,
but with other use cases as well.
Hello,
Multi-line lambda is element of many languages, but they are not needed in
the form in which they are made in many languages.
А good use would be to use the lambda as the last argument of the function.
Syntax:
def func(lambda1):
lambda1()func():
print(1)
Can be used for create dsl. For example html:
html:
head()body(): p(): "Hello world" a(href="python.org"): "Python link"
Or for create new syntax ... continue reading
I was reading a discussion thread https://gist.github.com/tiran/2dec9e03c6f901814f6d1e8dad09528e about various issues with the Debian packaged version of Python, and the following statement stood out for me as shocking:
Christian Heimes wrote:
Core dev and PyPA has spent a lot of effort in promoting venv because we don't want users to break their operating system with sudo pip install.
I don't think sudo pip install should break the operating system. And I think if it does, that problem sh... continue reading
I was reading a discussion thread https://gist.github.com/tiran/2dec9e03c6f901814f6d1e8dad09528e about various issues with the Debian packaged version of Python, and the following statement stood out for me as shocking:
Christian Heimes wrote:
Core dev and PyPA has spent a lot of effort in promoting venv because we don't want users to break their operating system with sudo pip install.
I don't think sudo pip install should break the operating system. And I think if it does, that problem sh... continue reading
Hi All,
I've been using the argparse library for a long time and one use case that
repeatedly shows us is the need to have two arguments appear together i.e
either both appear or none of them appear. I'll refer to these as mutually
inclusive in contrast to the existing mutual exclusive feature present.
I might be wrong but there seems to be no way to enforce this. Of course it
is possible to have two arguments that are required but it's not always
the case that they will be needed.
A mor... continue reading
I’m happy to announce that we’ve opened the sign-up forms for the 2021 Python Language Summit!
TL;DR
When: Tuesday, May 11, 2021 (4 hours) and Wednesday, May 12, 2021 (4 hours). Exact times TBD depending on attendee timezones.
Where: Online via Zoom (link will be sent via email to attendees)
Co-chairs: Mariatta Wijaya & Łukasz Langa
Blogger: Joanna Jablonski
Sign up to attend and actively participate: https://forms.gle/cgmGnmQMDhD2mhHY8 https://forms.gle/cgmGnmQMDhD2mhHY8 (closes after March... continue reading
The Steering Council just published the community update for January
(covering November/December as well):
https://github.com/python/steering-council/blob/master/updates/2021-01-steering-council-update.md
(included verbatim below). We'll be trying to keep this up monthly from now
on. I'll note that January was a very busy month with a lot happening, but
not a lot of long-term planning. I hope we'll be able to get back to that
soon.
Hello everyone,
I am Chandan Kumar, from Python India Community.
I would like to officially announce the 13th iteration of PyCon
India[1] for 2021.
Considering the health and safety of everyone involved, PyCon India
2021 will be taking place online as a 4-day event on Hopin[2] from
16th to 19th September 2021, including 2 conference days, 1 day of
workshops, and 2 days of Devsprints**.
The Call for Proposals for the conference will open in the first week
of March and close on 15th May 2021. ... continue reading
Hi,the list,
I'm wondering why Barrier object does not exist in the synchronization primitives of the asyncio lib while it is present in threading and multiprocessing libs ?
This may not be the right place to ask this question, but I never found an answer on the web.
Thanks for your help.
Yves
ACTIVITY SUMMARY (2021-02-19 - 2021-02-26)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7430 ( +2)
closed 47636 (+58)
total 55066 (+60)
Open issues with patches: 2946
#23882: unittest discovery doesn't detect namespace packages when give
https://bugs.python.org/issue23882 reopened by terry.reedy
#26600: Th... continue reading
As of 3.7, there is now a python feature called Development Mode:
https://docs.python.org/3/library/devmode.html#devmode
Which has a confusingly similar and nearly identical name to a setuptools feature:
It seems like a bit of bikeshedding could create a name for one of them that disambiguates them.
Best,
coyot
Hello!
I'm pleased to announce version 3.9.1, the first minor feature release
of branch 3.9 of SQLObject.
Adapt to the latest pg8000.
Protect getuser() - it can raise ImportError on w32
due to absent of pwd module.
Change URLs for oursql in extras_require in setup.py.
Provide separate URLs for Python 2.7 and 3.4+.
Add mariadb in extras_require in setup.py.
CI
... continue reading
On behalf of Twisted Matrix Laboratories, I am honored to announce the
release of Twisted 21.2.0!
There are two major announcements for this release:
Twisted 21.2.0 brings the following:
The standard library implements support for Linux's extended attribute
API with os.getxattr/setxattr/listxattr/removexattr. I'd like to
implement support for more platforms under the same API in the
standard library.
I've implemented a native-Python library (using ctypes) that runs CI
tests against Linux, Mac OS X and FreeBSD. If accepted, this library
could also be used to backport support to Python 3.6+.
https://github.com/dgilman/xattr-compat
API discussio... continue reading
Currently, the only way to concatenate an integer to a bytes object is by converting the integer to bytes with a function call before concatenating. And there is no way to make a mutable bytes object without a function call.
I propose an array-type string like the, or for the bytearray. It would work as a mutable b-string, as
foo = a"\x00\x01\x02abcÿ" # a-string, a mutable bytes object.
foo[0] = 123 # Item assignment
foo+= 255 ... continue reading
This is generic colouriser, version 1.12
grc is a colouriser configured by regular expressions, including
a simple command line wrapper for some commonly used unix commands.
Notable changes in this version:
License: GPL (any version)
URL: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
| Radovan Garabík http:/... continue reading
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.
Check them here and tell us... continue reading
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.
Check them here and... continue reading
Good Afternoon Python Devs,
I'm requesting that someone review the pull request linked to this issue: https://bugs.python.org/issue42994 (github PR: https://github.com/python/cpython/pull/24287).
I'm following the contributing guidelines instructions to email this address if the PR hasn't been addressed in a month (+1 week after pinging it again). Thankfully this PR is tiny, at 9 lines total (and even then, it's just 9 new entries to a dictionary).
Thank you for your time,
Nathan Beals
Currently, the only way to concatenate an integer to a bytes object is by
converting
the integer to bytes with a function call before concatenating. And there
is no way to
make a mutable bytes object without a function call. And bytearray function
calls are 9-10x slower than b-strings.
I propose an array-type string like the, or for the bytearray. It would
work as a
mutable b-string, as
foo = a"\x00\x01\x02abcÿ" # a-string, a mutable bytes object.
foo[0] = 123 ... continue reading
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.
Check them here and... continue reading
Remember us? It's your friendly CPython release team and we have something
we think you may like: The new alpha release of Python 3.10 is here, now
with 100% more pattern matching. If I were you, I would download it and
start playing with it. Extra points if you report us any bugs you find
along the way! Are you confused about all this pattern matching business?
Fear not, this release also includes some fantastic documentation and some
shiny new "What's new" entries.
Check them here and tell us... continue reading
This is to announce the release of version 1.1.4 of ycecream, a package
to help printing (debug) information in a more intuitive and more versatile
way than just print statements. And you get simple benchmarking (timing)
functionality as a bonus.
The package can be installed from PyPI with pip install ycecream or
directly from GitHub: https://github.com/salabim/ycecream
Short introduction:
Inspect variables and expressions
Have you ever printed variables or expressions to deb... continue reading
I love the Python scripting language, but there’s something that would make
it much better. Almost every other programming language uses curly braces
to enclose blocks of code and semicolons after the lines of code. That
means that:
You can have as much white space as you want.
2.
You don’t need to worry about indentation, and you can indent whenever
you want.
I hope that you consider these issues and fix them in Python 4 (if you ever
make it).
Sincerely, Anthony, age 10.
... continue reading
---------- Forwarded message ---------
From: Anthony Farino anthonyf@pacemschool.org
Date: Wed, Mar 3, 2021 at 5:52 PM
Subject: [Python-Dev] Suggestion About Python Syntax
To: python-dev@python.org
I love the Python scripting language, but there’s something that would make
it much better. Almost every other programming language uses curly braces
to enclose blocks of code and semicolons after the lines of code. That
means that:
You can have as much white space as you want.
2.
... continue reading
Hi everyone,
This is a maintenance release to make use of the oldest supported NumPy
version
when building wheels, in an effort to alleviate issues seen on Windows
machines
that do not have the latest Windows MSVC runtime installed. It also adds
wheels built via GitHub Actions for ARMv8 platforms.
Project documentation is available at:
http://numexpr.readthedocs.io/
Changes from 2.7.2 to 2.7.3
-----... continue reading
Hi Mark,
Thank you for submitting PEP 651. The Steering Council has spent the past two weeks reviewing PEP 651. After careful consideration, we have decided to reject the PEP. The following were the key points that led us to this decision:
The benefits are not compelling enough. Deep recursion is not a common tool in
Python, and even with PEP 651 it would not be efficient enough to make it a common
tool.
The benefit of PEP 651 is negated as soon as a non-Python function is involved... continue reading
Hi,
Python has an all variable that can be defined in a module to restrict
which members of the module should be included in a call from foo import *. However specifying which members of the module should be excluded is
more difficult. There are three workarounds that I see:
Defining all to specify most of the members of the module, except
the few that should be excluded.
Naming members to be excluded with a leading underscore. e.g. as done
here in ctypes:
https://github.com/p... continue reading
Please, is there a reason why extend() method does not return self?
a = [1,2].extend((3,4))
a
type(a)
<class 'NoneType'>
b = [1,2]
b.extend((3,4))
b
[1, 2, 3, 4]
Please, consider class(obj) to return obj.class
consistenly with dir(), vars(), repr(), str(),…
class c: pass
o = c()
o.class
<class 'main.c'>
class(o)
File "<stdin>", line 1
class(o)
^
SyntaxError: invalid syntax
Thank you in advance,
H.
The PEPs repo [1] has a README [2] with instructions for configuring a local installation of the python.org website such that you can develop PEPs locally and see how they will appear on python.org locally. However the README's instructions reference a python.org configuration setting (PEP_REPO_PATH) that appears to no longer exist.
So I reimplemented support for the PEP_REPO_PATH setting for local python.org installations and have a pull request out for review at [3] which has been seeking a r... continue reading
I was curious how and why return annotations use the arrow -> symbol,
so I went spelunking into the depths of the Python-Ideas and Python-Dev
mailing lists.
Much to my surprise, I couldn't find any discussion or debate about it.
Eventually I tracked the discussion back to a mailing list I didn't even
know existed, Types-Sig, all the way back to 13th Dec 1999, where I
found this email by Tim Hochberg:
https://mail.python.org/pipermail/types-sig/1999-December/000281.html
suggesting the a... continue reading
Currently, list.reverse() only works for an entire list. If one wants to reverse a section of it 'in-place', one needs to slicing which makes the space complexity no longer O(1). One can also manually make a loop and do the reversal but that is even slower than slicing. List.reverse() does not take any arguments. Wouldn't it be a good if it can take in parameters such as 'start' and 'stop' to enable list.reverse() work even for a section of the list? When no arguments are specified, then it work... continue reading
Dear all,
After several months of absence - my first manual build surprised me by
the addition of the -qalias=noansi.
Before I open an issue - maybe it is not that important - I am trying to
find what brought it in. It looks to be a change in behavior in
configure(.ac) - starting with Python3.9.
Historical builds - and make.out:
py38-3.8.7/.buildaix/make.out:0
py39-3.9.0/.buildaix/make.out:239
py39-3.9.1.0/.buildaix/make.out:254
py39-3.9.1/.buildaix/make.out:148
py3a-3.10/.buildaix/make.o... continue reading
ACTIVITY SUMMARY (2021-02-26 - 2021-03-05)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7444 (+14)
closed 47702 (+66)
total 55146 (+80)
Open issues with patches: 2959
#43331: [Doc][urllib.request] Explicit the fact that header keys are s
https://bugs.python.org/issue43331 opened by axel3rd
#43332: http/cli... continue reading
Announcing:
managesieve 0.7
ManageSieve client library for remotely managing Sieve scripts,
including an user application (the interactive 'sieveshell').
:Homepage: https://managesieve.readthedocs.io/
:Author: Hartmut Goebel h.goebel@crazy-compilers.com
:License:
- for the managesieve module: Python-Software-Foundation-like License
- for sieveshell and test suite: GNU Public Licence v3 (GPLv3)
:Quick Installation:
pip install -U managesieve
:... continue reading
Announcing:
python-ghostscript 0.7
A Python-Interface to the Ghostscript
C-API using ctypes
:License: GNU General Public License v3 or later (GPLv3+)
:Author: Hartmut Goebel h.goebel@crazy-compiler.com
:Homepage: https://gitlab.com/pdftools/python-ghostscript
:Download: https://pypi.python.org/pypi/ghostscript
Ghostscript__, is a well known interpreter for the PostScript
language and for PDF. This package implements a interface to t... continue reading
Hi all,
I have submitted a PR, GH-24118 (
https://github.com/python/cpython/pull/24118), on January 5.
It's a relatively simple patch that fixes smtplib.SMTP logic for AUTH
LOGIN, alongside a fix for the test for that class.
The PR has passed all checks, and I have also signed the CLA.
I've pinged the relevant bpo more than a week ago, but the PR's status is
still "awaiting review".
I'd appreciate it if someone can spare some time to do a review on this
simple patch.
FdS Pandu E ... continue reading
Apologies if this has already been raised at some point, but I wanted to
raise the idea of a basic standard library toolkit for operations on
async iterators.
This would include versions of functions that are already in the
standard library for non-async iterators, such as map, filter,*zip
*etc. It could also include a merge function for async iterators, for
example (this would yield items in whatever order they are yielded from
from the constituent iterators).
There are, of course, open... continue reading
Hi,
The Python bug tracker currently has 78 open issues of the type
Security. If you are looking for something to do to help the Python
project, please go through the list (search for open issues with
Type=security at bugs.python.org), discuss the different solutions how
to address these vulnerabilities, and maybe even propose a fix.
Here are some examples.
== tarfile ==
For example, the tarfile module has a known directory traversal
vulnerability (unsafe by default), whereas the GNU tar com... continue reading
Hi all, I recently ran into a problem trying to adapt mypy into an older
codebase, and it got me thinking about a potential addition to the typing
library.
This idea comes in two parts (that can even be taken individually): the
first is to allow the False singleton literal to be used in type
annotations, much like how None is now allowed. False will in fact mean
"any object for which the not operator will return True".
The second part is to add a generic shorthand to the typing module:
`typin... continue reading
Hi everyone,
The Steering Council just published the community update for February:
https://github.com/python/steering-council/blob/main/updates/2021-02-steering-council-update.md
As a reminder, we'll are trying to keep this up monthly. As you can see we
are mainly focusing on clearing the PEP backlog and to address ongoing
efforts and time-sensitive issues. Here you can find the text for the
update:
February 01
After more deliberation and consideration of all available information... continue reading
Hi,
Why choose "main" as a replacement for "master"?
It's the development branch, shouldn't we call it "development" or "dev"?
We give release branches meaningful names, so why give the development
branch the not-so-meaningful name "main".
From a user's perspective the "main" branch is whatever their version
of Python is built from.
Cheers,
Mark.
Hi,
I am writing on behalf of the Python Release Management team. The Steering
Council has requested the RM team to schedule
and perform the necessary changes to rename the default branch from master
to main.
What follows is the technical description of the changes and the timeline.
In order to keep this thread focused on this particular
aspect, if you wish to discuss anything related to the change itself,
please, open a new email thread or reuse an existing one.
Hi,
I am using cprofile and PStats to try and figure out where bottlenecks are in a program. When I sum up all of the times in the "tottime" column, it only comes to 57% of the total runtime. Is this due to rounding of times or some other issue?
Thanks,
Jonathan
I had posted this as https://github.com/python/peps/issues/1867
The discussion so far is below.
Please make some arguments.
The major point to me is, that the symmetry is broken,
which leads to extra editing actions, like removing the comma in the first line.
I guess, this was the reason to allow the comma after the last line/entry: [1,2,].
[,1,2] should also be allowed, too.
The best argument is one that says: less or more effort in this or that situation.
For example, with [1,2,], i... continue reading
Hi,
It's becoming more popular in Python to have interfaces which are built around method chaining as a way of applying operations to data. For example in pandas is moving more towards a default model where methods do not change the object in-place but instead return an altered version (or at least an altered view) of it.
The major downside to method chaining is that it ends up creating long lines of code which can become hard to read. The two main solutions to this are 1) break down the chain... continue reading
currently in a dataclasses.dataclass based class, you can either have it hashable and completely immutable (using frozen=True and eq=True), or you can have it hashable but completely mutable (by using unsafe_hash=True)
unsafe_hash provides the convenience of being able to mutate some fields, while computing your hash by other, non-mutable fields. But there is nothing enforcing the fact that the fields marked with hash=True should stay immutable, otherwise it completely breaks hashability.
... continue reading
ACTIVITY SUMMARY (2021-03-05 - 2021-03-12)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7478 (+34)
closed 47738 (+36)
total 55216 (+70)
Open issues with patches: 2968
#43198: Operations on sets more than hundred times less efficient with
https://bugs.python.org/issue43198 reopened by rhettinger
#43411: wm_... continue reading
A question that comes up quite a bit on Stackoverflow is how to test to see if a value will result in an Enum member, preferably without having to go through the whole try/except machinery.
A couple versions ago one could use a containment check:
if 1 in Color:
but than was removed as Enums are considered containers of members, not containers of the member values. It was also possible to define one's own _missing_ method and have it return None or the value passed in, but that has also ... continue reading
Hi,
I was refactoring some code today and ran into an issue that always bugs me with
Python modules. It bugged me enough this time that I spent an hour banging out this
potential proposal to add a new contextual keyword. Let me know what you think!
Theia
A typical pattern for a python module is to have an init.py that looks
something like:
from .foo import (
A,
B,
C,
)
from .bar import (
D,... continue reading
[I'm sort of loose with the terms field, parameter, and argument here.
Forgive me: I think it's still understandable. Also I'm not specifying
types here, I'm using Any everywhere. Use your imagination and
substitute real types if it helps you.]
There have been many requests to add keyword-only fields to dataclasses.
These fields would result in init parameters that are keyword-only.
As long as I'm doing this, I'd like to add positional-only fields as well.
Basically, I want t... continue reading
I’m happy to announce the v2.6.0 release of django-minio-backend!
django-minio-backend provides a wrapper around the official MinIO Python SDK enabling easy integration with MinIO for Django developers.
You can learn more about MinIO the S3-compatible object storage here: https://min.io
Release Notes:
• New manage.py command: is_minio_available
• Updated minIO SDK from 7.0.0 to 7.0.2
• updated imports
• updated self.client.list_objects_v2 to self.client.list_objects
• Added get_availab... [continue reading](https://mail.python.org/archives/list/python-announce-list@python.org/thread/2P4POZWSB7FSNQL5HLTVOM7NHOR35CLB/)
Hi dev-team, I'm reopening the discussion of PEP 473, which was closed due
to:
The steering council felt the PEP was too broad and not focused enough.
Discussions about adding more attributes to built-in exceptions can
continue on the issue tracker on a per-exception basis (and obviously here
for any broader points, e.g. performance implications as I know that has
come up before when the idea of storing relevant objects on exceptions).
Before the PEP was rejected by the SC, I had submitted
h... continue reading
Hi Inada,
Thank you for submitting PEP 624 (Remove Py_UNICODE encoder APIs). The
Steering Council is happy to accept it, but we do have two conditions. We
want to make sure that the documentation is clear on what is deprecated,
and when they are scheduled to be removed. For example,
PyUnicode_TransformDecimalToASCII is itself not currently marked as
deprecated (although the section header does mention the deprecation, that
is easy to miss), PyUnicode_TranslateCharmap is scheduled for removal in... continue reading
Hi Inada,
Thank you for submitting PEP 597 (Add optional EncodingWarning). The
Steering Council is happy with the PEP, and hereby accepts it. The SC is of
the opinion that we should move towards making UTF-8 the default encoding,
and this PEP will make it easier to do so, and mitigate some of the
confusion around the default encoding in the meantime.
That being said, the SC would like to invite you and others with interest
to work on a PEP for a long term plan to, in fact, change the default
e... continue reading
Hi Stefano,
Thank you for submitting PEP 637 (Support for indexing with keyword
arguments). The Steering Council has reviewed the PEP and after careful
consideration, we have decided to reject the PEP. There are a number of
reasons for this, but fundamentally we do not believe the benefit is great
enough to outweigh the cost of the new syntax.
The benefits of the new syntax as outlined in the PEP are not particularly
strong, and community support for the new syntax seems low. The new syntax
do... continue reading
[I'm sort of loose with the terms field, parameter, and argument here.
Forgive me: I think it's still understandable. Also I'm not specifying
types here, I'm using Any everywhere. Use your imagination and
substitute real types if it helps you.]
Here's version 2 of my proposal:
There have been many requests to add keyword-only fields to dataclasses.
These fields would result in init parameters that are keyword-only.
In a previous proposal, I suggested also including positiona... continue reading
Hi, all.
I found .pth file is decoded by the default (i.e. locale-specific) encoding.
https://github.com/python/cpython/blob/0269ce87c9347542c54a653dd78b9f60bb9fa822/Lib/site.py#L173
pth files contain:
For import statement, UTF-8 is the default Python code encoding.
For paths, fsencoding is the right encoding. It is UTF-8 on Windows
(excpet PYTHONLEGACYWINDOWSFSENCODING is set), and locale-specific
encoding in Linux.
What encoding should we use?
Hi fellow Pythonistas!
A colleague of mine recently got me involved in the Julia language and
while I was really impressed by the performance, the complete lack of
OOP and thus bad discoverability (not to mention all their unicode
function names) for me leaves a lot to be desired.
TL;DR:
Julia uses a type-based multi-method system (multiple dispatch), that
because of type-stability allows JIT compilation of very efficient code.
Since Pythons single-dispatch classes are a subset of that s... continue reading
With some of the dataclass threads in python-ideas ongoing, I wanted to
add another to the fray.
There's an area where typing.get_type_hints on dataclass and init
produce inconsistent results. Example:
@dataclass
class Foo:
x: int = None
typing.get_type_hints(Foo)
{'x': <class 'int'>}
typing.get_type_hints(Foo.init)
{'x': typing.Optional[int], 'return': <class 'NoneType'>}
My wish list item would be for the dataclass annotations to match
init's.
R... continue reading
Consider this little session from the tip of the spear:
sys.version
'3.10.0a6+ (heads/master:0ab152c6b5, Mar 15 2021, 17:24:38) [GCC 10.2.0]'
def while2(a):
... while a >= 0:
... a -= 1
... return a
...
dis.dis(while2)
2 0 LOAD_FAST 0 (a)
2 LOAD_CONST 1 (0)
4 COMPARE_OP 5 (>=)
6 POP_JUMP_IF_FALSE 24
3 >> 8 LOAD_FAST 0 (a)
10 LOA... continue reading
Dear python-dev,
New here (but not to Python). 👋 Brett Cannon recommended I start a thread here (thanks, Brett!).
In December, two colleagues and I submitted https://github.com/python/cpython/pull/23847, "Add aiter and anext to builtins", which would fix https://bugs.python.org/issue31861.
Would any core developers who may be reading this be willing and able to provide a code review?
We would love to try to address any review feedback before having to fix (another round of) merge con... continue reading
Hi,
Python supports IPv4-mapped IPv6 addresses as defined by RFC 4038:
"the IPv6 address ::FFFF:x.y.z.w represents the IPv4 address x.y.z.w.”
The current behavior is as follows:
from ipaddress import ip_address
addr = ip_address('::ffff:8.8.4.4') # IPv6Address('::ffff:808:404')
addr.ipv4_mapped # IPv4Address('8.8.4.4')
Note that the textual representation of the IPv6Address is not in IPv4-mapped format.
It prints ::ffff:808:404 instead of ::ffff:8.8.4.4.
This is technically c... continue reading
Hi all,
Not sure if this feature already exists in python or if it has been proposed already but it would be extremely helpful for me and doesn't seem too difficult to implement.
I often write functions with really long kwarg names that call other functions that share a kwarg name.
What I currently have is something like (very simplified example)
def function1(x, y, some_really_long_kwarg=True, **kwargs):
other_kwarg = x>y
function2(x, y, some_really_long_kwarg=some_really_long_kwarg,... continue reading
I know that range(start,end,stride) will produce what I'd want from
iter(slice(start,end,stride)), but wouldn't it be reasonable for a slice
itself to be iterable?
Yes, only one obvious way and all that, but inside eg getitem it
seems to me that:
if isinstance(index, slice):
for i in index:
... do stuff with i ...
is the obvious thing to do.
Cheers,
Cameron Simpson cs@cskk.id.au
Apologies in advance for the cross-post!
I’m happy to announce the release of PyData/Sparse 0.12.0!
PyData/Sparse provides sparse arrays with a NumPy-like API for the PyData ecosystem.
This is a large release with GCXS support, preliminary CSR/CSC support and extensions to DOK, as well as bugfixes.
Changelog: https://sparse.pydata.org/en/stable/changelog.html
Documentation: https://sparse.pydata.org/
Source: https://github.com/pydata/sparse/
Best regards,
Hameer Abbasi
--
S... continue reading
ACTIVITY SUMMARY (2021-03-12 - 2021-03-19)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7481 ( +3)
closed 47813 (+75)
total 55294 (+78)
Open issues with patches: 2980
#35943: PyImport_GetModule() can return partially-initialized module
https://bugs.python.org/issue35943 reopened by pitrou
#37788: fix for b... continue reading
This is closely related to https://bugs.python.org/issue40230 - "Itertools.product() Out of Memory Errors."
itertools.product() completely consumes all input iterables before yielding any values, which can cause memory issues in certain (extreme) cases.
I recently needed to partially iterate through the product of two very large iterators which were themselves power sets of some input values. For unlucky inputs these iterators were enormous (but not infinite) and itertools.product() used up... continue reading
An odd suggestion/request here, hope it's the right place to discuss it.
So I was trying to install python on the Xbox series S (yup..), so far I got the embedded x86_64 version for windows to work, however, I was unable to get packages to install properly.
I'm not familiar enough with Windows to know how the installation is supposed to be laid out, but I figured it might be just a side affect from using the embedded version.
Now I need to mention that the Xbox is an odd NT based system, it can... continue reading
Back in the late 90s (!) I worked on a reimagining of the Python
virtual machine as a register-based VM based on 1.5.2. I got part of
the way with that, but never completed it. In the early 2010s, Victor
Stinner got much further using 3.4 as a base. The idea (and dormant
code) has been laying around in my mind (and computers) these past
couple decades, so I took another swing at it starting in late 2019
after retirement, mostly as a way to keep my head in the game. While I
got a fair bit of the ... continue reading
Hi everyone,
We've got to the stage now with PEP 646 that we're feeling pretty happy
with it. So far though we've mainly been workshopping it in typing-sig, so
as PEP 1 requires we're asking for some feedback here too before submitting
it to the steering council.
If you have time over the next couple of weeks, please take a look at the
current draft and let us know your thoughts:
https://www.python.org/dev/peps/pep-0646/ (Note that the final couple of
sections are out of date; https://github.c... continue reading
We would like to present for feedback a new version of PEP 654, which
incorporates the feedback we received in the discussions so far:
https://www.python.org/dev/peps/pep-0654/
The reference implementation has also been updated along with the PEP.
The changes we made since the first post are:
Hello,
It seems the buildbot Web UI has the bad habit of auto-refreshing
itself (by doing a full page reload) every minute or two. I also
couldn't find a setting to disable it (despite being logged in). Am I
missing something?
Regards
Antoine.
竜 TatSu is a tool that takes grammars in a variation of EBNF as input, and
outputs memoizing (Packrat) PEG parsers in Python.
竜 TatSu inspired the PEG parser in Python 3.9.
New in 竜 TatSu 5.6.0
contexts.ParseContextignorecase settings apply to defined @@keywordsParseContextPyWeek is a twice-a-year game jam that has been running for the past 15 years. Starting on the first day of the jam (Sunday, March 28), you start coding, designing, and developing your game. This can be done as an individual or with a team. By Sunday, April 3rd you must submit your entry on the PyWeek website (pyweek.org) for it to be counted as a valid submission.
You can register on PyWeek.org. Head over to that webpage, click on the "Latest Challenge", and you should see an option to "Regist... continue reading
Hi,
tl;dr Tests of the Python Test Suite now start with 131 imported
modules, instead of 233. For example, asyncio, logging,
multiprocessing and warnings are no longer imported by default.
--
The Python test suite is run by a custom test runner called
"libregrtest" (test.libregrtest). It can detect reference leaks, write
the output as JUnit XML, run tests in parallel with multiple
processes, etc. Tests are written with test.support which is a
collection of helper functions.
Over the years, t... continue reading
Hello,
The GUI section of PEP 636 reads: "It will also requires that the event has
a position attribute that matches the (x, y) pattern". It should read "It
will also require that the event has a position attribute that matches the
(x, y) pattern".
Thanks,
Bill
Hi,
(This is great language, sincere thanks to all!)
I took a quick glance of https://devguide.python.org/langchanges/ (20.3.
Suggesting new features and language changes), while writing this post.
Please ignore this, if similar proposals are discussed earlier.
Suggestion:
Is it possible to introduce Big Set / Big Dictio... continue reading
From Thomas Wouters, on behalf of and with full support of the Python Steering Council:
This discussion seems to have died down a little, but I still want to make a few things clear:
Yes, this is a political decision. Very many decisions are political. The existence of an open-source project is inherently political. The decision to try and make python-dev more welcoming, more open, more helpful is also a political decision -- one that the SC feels is absolutely necessary for the long-term heal... continue reading
Hello, a while back we hit a bug with doctest and mock.call that
confused a few people on our team for a while.
I dug into fixing it and made doctest more defensive around
un-unwrappable calls.
I submitted a PR (https://github.com/python/cpython/pull/22981) for an
Issue (https://bugs.python.org/issue35753) back in October 25, 2020
which got some review, and then have not heard for several months.
I am wondering if it can be reviewed and feedback given on a way forward.
Thank you,
-Alfre... continue reading
Hi all,
What about of using modern C++ in developing CPython ?
With C++ we can get the following benefits:
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.6.2, which is a bug fix release.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.6.2
https://github.com/scipy/scipy/releases/tag/v1.6.1
One of a few ways to install this release with pip:
pip install scipy==1.6.2
SciPy 1.6.2 is... continue reading
This year's conference will mark the 20th edition of the EuroPython
conference.
* EuroPython 2021 *
https://ep2021.europython.eu/
Since we started touring Europe in 2002 in Charleroi, Belgium, we have
come a long way. The conference has grown from the initial 240 to around
1200-1400 attendees every year. The organization had started with a
small group of people in a somewhat ad-hoc way and has now grown into a
well structured team backed by the non-... continue reading
Hi,
A new Include/README.rst file was just added to document the 3 C API
provided by CPython:
I would like to note that new public C API functions must no longer
steal references or return borrowed references.
Don't worry, there is no plan to deprecate or remove existing
functions which do that, like PyModule_AddObject() (streal a
reference) or PyDict_GetItem() (return a borro... continue reading
PyCA cryptography 3.4.7 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-4-7):
-Paul Kehrer (reaperhulk)
I posted this to LWN, and thought I'd share it here too:
I'm opposed to terse-ifying lambda in Python.
Lambda is rarely useful in Python - you're almost always better off using a
generator expression, a list comprehension, or something from the operator
module.
And lambdas tend to give rise to the software development equivalent of a
runon sentence.
Naming a function in those rare cases that you genuinely need something
custom really isn't the end of the world, and is more readable anyway.
... continue reading
Hi,
OpenSSL released 1.1.1k today with two high severity CVEs,
https://www.openssl.org/news/vulnerabilities.html
The ssl module is not affected by CVE-2021-3450 in its default
configuration. Python does not set X509_V_FLAG_X509_STRICT on
SSLContext. Only applications that that use ssl.VERIFY_X509_STRICT
verify flag are affected.
It looks like Python's ssl module is vulnerable to CVE-2021-3449. The
crash does not affect pip, requests, or any other client-side socket.
Only server-side SSL/TLS ... continue reading
I would contribute to the project in my spare time. Can someone point
me to some easy task? I know C and the Python C API a little.
I have just been writing some code in which I define a custom log level with the logging module. I wanted to call the new log level as an attribute but currently the logging library lacks a nice way to do this. I know that in the docs https://docs.python.org/3/howto/logging.html#custom-levels it discourages creating custom log levels so perhaps this was why there is no way to do this. This https://stackoverflow.com/questions/2183233/how-to-add-a-custom-loglevel-to-pythons-logging-facility/136380... continue reading
I have this documentation:
.. class:: FlagBoundary
*FlagBoundary* controls how out-of-range values are handled in *Flag* and its
subclasses.
.. attribute:: STRICT
Out-of-range values cause a :exc:`ValueError` to be raised. This is the
default for :class:`Flag`::
>>> from enum import STRICT
>>> class StrictFlag(Flag, boundary=STRICT):
... RED = auto()... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/VW4QL2URYXQUUNIA3OGDXZOHKS3LSDIK/)
ACTIVITY SUMMARY (2021-03-19 - 2021-03-26)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7498 (+17)
closed 47871 (+58)
total 55369 (+75)
Open issues with patches: 2984
#33164: Blake 2 module update
https://bugs.python.org/issue33164 reopened by christian.heimes
#42129: Support resources in namespace package... continue reading
Hello,
I've been chasing down various synchronization bugs in a large codebase
I'm working on.
In the process I began to realize how useful it would be to have some
sort of descriptor (a name if you will) attached to some of my
primitives.
In this code base, I've a number of threading.Event objects that get
passed around to check for conditions. In a perfect world, every
developer would have used the same nomenclature and been consistent
everywhere. Alas....
Currently there i... continue reading
Forgive me if this isn't the correct venue for this question and I ask your help directing me to the correct place if it is not.
In PEP-376 it states with respect to the valid hashes in a Wheel RECORD file:
"The hash is either the empty string or the hash algorithm as named in hashlib.algorithms_guaranteed, followed by the equals character =, followed by the urlsafe-base64-nopad encoding of the digest (base64.urlsafe_b64encode(digest) with trailing = removed)."
In PEP-427 it further restricts... continue reading
Hi everyone,
As the 3.10 beta is not so far away, I've cut down PEP 653 down to the
minimum needed for 3.10. The extensions will have to wait for 3.11.
The essence of the PEP is now that:
The semantics of pattern matching, although basically unchanged, are
more precisely defined.
The match_kind special attribute will be used to determine which
patterns to match, rather than relying on the collections.abc module.
Everything else has been removed or deferred.
The PEP now has onl... continue reading
Charles R Harris charlesr.harris@gmail.com
Sun, Feb 7, 2:23 PM
to numpy-discussion, SciPy, SciPy-User, bcc: python-announce-list
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.20.2. NumPy 1,20.2 is a bugfix release containing several fixes merged to
the main branch after the NumPy 1.20.1 release. The Python versions
supported for this release are 3.7-3.9. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.20.2/; source archives,... continue reading
Hello,
imphook is a simple, small single-file module and a tool which allows
to easily and selectively override Python import machinery for
particular file types (including Python source files).
As an example of usage, recently on the python-ideas mailing list,
there was a discussion about "arrow functions" for Python (as a
syntactic alternative to lambda). A prototype implementation using
"imphook" was posted:
https://mail.python.org/archives/list/python-ideas@python.org/thread/VOVHZUNJKCVCIP... continue reading
Hello Mario,
Thank you for your submission of PEP 648 (Extensible customizations of the interpreter at startup). The Python Steering Council has reviewed the PEP and before we can pronounce on it, we have some additional questions and comments we’d like you to address. Once these questions are settled, we are requesting that you post the PEP to python-dev for another round of comments.
In general, the SC is in favor of deprecating the executable hack capabilities of pth files, and this PEP i... continue reading
Hi Christian,
Thank you for submitting PEP 644 (Require OpenSSL 1.1.1). After evaluating
the situation and discussing the PEP, the Steering Council is happy with
the PEP,
and hereby accepts it. The SC is of the opinion that this change will make
it considerable
easier to maintain the extension modules that depend on OpenSSL while
allowing us
to leverage the new APIs and improvements in the future. As indicated in
the PEP,
OpenSSL 1.1.1 is the default variant and version of OpenSSL on almost all... continue reading
Hi,
The io module provides an open() function. It also provides an
OpenWrapper which only exists to be able to store open as a method
(class or instance method). In the _pyio module, pure Python
implementation of the io module, OpenWrapper is implemented as:
class OpenWrapper:
"""Wrapper for builtins.open
Trick so that open won't become a bound method when stored
as a class variable (as dbm.dumb does).
See initstdio() in Python/pylifecycle.c.
"""
def __new__(cls, *arg... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/QZ7SFW3IW3S2C5RMRJZOOUFSHHUINNME/)
It occurs to me it's a syntax error everywhere to put two
potentially-calculable terms in a row with nothing between them, e.g.:
a = b c
mylist = [x 6 for x in y if "a" in x]
Unless I'm missing something, this makes it relatively easy (from a
syntax perspective; writing a parser r hard) to detect such:
a = b c 6 ** + 5 /
mylist = [x 6 + for x in y if "a" in x]
This is a bit less ambiguous and simpler to write (and easier to read,
caveat you have to... continue reading
Dear pythonistas,
I was wondering if we could add a clarification to PEP 394? I'm trying to
get some visibility on this.
There's a bullet in the PEP that states:
For scripts that are only expected to be run in an activated virtual
environment, shebang lines can be written as #!/usr/bin/env python, as this
instructs the script to respect the active virtual environment.
Could we clarify the following?
ACTIVITY SUMMARY (2021-03-26 - 2021-04-02)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7505 ( +7)
closed 47938 (+67)
total 55443 (+74)
Open issues with patches: 2984
#37368: test_asyncio: test_create_server_ssl_match_failed() failed on
https://bugs.python.org/issue37368 reopened by nascheme
#43510: PEP 5... continue reading
Those are expedited security releases, recommended to all users. Get them here:
https://www.python.org/downloads/release/python-393/ https://www.python.org/downloads/release/python-393/
https://www.python.org/downloads/release/python-389/ https://www.python.org/downloads/release/python-389/
Security Content
bpo-43631 https://bugs.python.org/issue43631: high-severity CVE-2021-3449 and CVE-2021-3450 were published for OpenSSL, it’s been upgraded to 1.1.1k in CI, and macOS and Windows inst... continue reading
Those are expedited security releases, recommended to all users. Get them here:
https://www.python.org/downloads/release/python-393/ https://www.python.org/downloads/release/python-393/
https://www.python.org/downloads/release/python-389/ https://www.python.org/downloads/release/python-389/
Security Content
bpo-43631 https://bugs.python.org/issue43631: high-severity CVE-2021-3449 and CVE-2021-3450 were published for OpenSSL, it’s been upgraded to 1.1.1k in CI, and macOS and Windo... continue reading
I’m working towards supporting subclassing pathlib.Path for things like
zip/tar archives, iso files, S3, etc. This was first brought up a few years
ago in bpo-24132 https://bugs.python.org/issue24132 and discussed further
on the python-ideas forum
https://discuss.python.org/t/make-pathlib-extensible/3428.
Before I can approach the meat of the issue, I'd like to land a handful of
backwards-compatible patches that tidy up the pathlib internals. These are:
Dear pythonistas,
I would really like having a function like String.substringAfter(sep) and String.substringBefore(sep) as in Kotlin.
fun String.substringAfter(
delimiter: String,
missingDelimiterValue: String = this
): String
substringAfter/substringBefore takes a delimiter, and keeps everything after the first occurrence of the delimiter. This could be useful for simple HTML parsing for example. It also take a second argument to use as value when the seperator is not found (default... continue reading
The memory layout of PyThreadState was unintentionally changed in the recent 3.9.3 bugfix release. This leads to crashes on 32-bit systems when importing binary extensions compiled for Python 3.9.0 - 3.9.2. This is a regression.
We will be releasing a hotfix 3.9.4 around 24 hours from now to address this issue and restore ABI compatibility with C extensions built for Python 3.9.0 - 3.9.2.
Details:
https://bugs.python.org/issue43710
typing.Annotated could be used to build dataclasses. Using Annotated will allow libraries to add functionality to a dataclass without having to change dataclass creation or behavior. The example below shows how a dataclass could be implemented. It continues the example of struct2 shown in pep593. From a dataclass point of view, the Sample and AnnotatedSample would be equivalent.
@dataclass
class Sample:
a: int
b: int
c: int = field(default=5)
d: int = 10
e: int = f... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/TI4ZHEJSP5NWPO4NHR2EKNZQYLZMGR2J/)
pytest 6.2.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
When importing the curses module, be it on Windows or Darwin or UNIX-based OS or any other platform, if the _curses module is not found then just a ModuleNotFoundError is raised. But this error is not very informational in case of _curses module. Since the curses module is packaged with the Python interpreter itself at first it may seem, to beginners especially, that the Python interpreter was not installed correctly and then they would go searching for an answer for about 4-5 days.
We know th... continue reading
Python 3.9.3 was released two days ago on Friday, April 2nd. It contains important security content listed below for reference. Unfortunately, it also introduced an unintentional ABI incompatibility, making some C extensions built with Python 3.9.0 - 3.9.2 crash with Python 3.9.3 on 32-bit systems. To minimize disruption, I decided to recall 3.9.3 and introduce this hotfix release: 3.9.4.
We highly recommend upgrading your Python 3.9 installations to 3.9.4 at your earliest convenience.
Get it... continue reading
Python 3.9.3 was released two days ago on Friday, April 2nd. It contains important security content listed below for reference. Unfortunately, it also introduced an unintentional ABI incompatibility, making some C extensions built with Python 3.9.0 - 3.9.2 crash with Python 3.9.3 on 32-bit systems. To minimize disruption, I decided to recall 3.9.3 and introduce this hotfix release: 3.9.4.
We highly recommend upgrading your Python 3.9 installations to 3.9.4 at your earliest convenience.
Ge... continue reading
Hi Petr,
Thank you for submitting PEP 652 (Maintaining the Stable ABI). After
evaluating
the situation and discussing the PEP, the Steering Council is happy with
the PEP
and hereby accepts it. The Steering council thinks that this is a great
step forward
in order to have a clear definition of what goes into the Stable ABI and
what guarantees
the Python core team offers regarding the stable ABI while offering at the
same time a
plan to improve the maintenance and stability of the stable ABI.
We... continue reading
I recently rebuilt my server (Ubuntu 20.04) and rebuilt mailman 2 - upgrading to the latest version 2.1.34. The mail server is postfix
I run three mailing lists, including "TESTmail". The same issue below affects all three lists.
On the General Page, I have filled in an administrator and a owner. The list options are set up that emails from non-members are held and the moderator should be notified.
I'm happy to announce the release of NoPdb 0.1.0!
NoPdb is a non-interactive (programmatic) debugger for Python. This means it gives you access to debugger-like superpowers directly from your code. NoPdb allows to:
Brrrrr..... do you feel that? That's the chill of beta freeze coming
closer. Meanwhile, your friendly CPython release team doesn’t
rest even on holidays and we have prepared a shiny new release for you:
Python 3.10.0a7.
Dear fellow core developer:
This alpha is the last release before feature freeze (2021-05-03), so make
sure that all new features and PEPs are landed in the master branch before
we
release the first beta. Please, be speciall... continue reading
Brrrrr..... do you feel that? That's the chill of beta freeze coming
closer. Meanwhile, your friendly CPython release team doesn’t
rest even on holidays and we have prepared a shiny new release for you:
Python 3.10.0a7.
Dear fellow core developer:
This alpha is the last release before feature freeze (2021-05-03), so make
sure that all new features and PEPs are landed in the master branch before
we
release the first beta. Please, b... continue reading
The Python Steering Council reviewed PEP 647 -- User-Defined Type Guards, and is happy to accept the PEP for Python 3.10. Congratulations Eric!
We have one concern about the semantics of the PEP however. In a sense, the PEP subverts the meaning of the return type defined in the signature of the type guard, to express an attribute of the type guard function. Meaning, type guard functions actually do return bools, but this is not reflected in the return type:
"Using this new mechanism, the ... continue reading
Cross-posted from https://discuss.python.org/t/8111 on Brett’s suggestion.
A while ago, I proposed pip’s migration plan from distutils to sysconfig[1], in
preparation of distuitls’s deprecation and planned removal in Python 3.12. When
working on the implementation, however, I realised sysconfig currently lacks
important abstractions that pip needs to correctly interface with downstream
Python redistributors and alternative Python implementations. I raised the
issue in b.p.o.43312[2] and provide... continue reading
Hi developers,
What should / shouldn't I do to attract any python developer response to
issue tracker items? I am unsure of the proper procedure to follow so I am
asking here first.
I have filed two issues on the python issue tracker for python curses
issues:
documentation file uploaded)
2. # 43716, a possible ABI issue for the curses.pair_number() function
return value in a Windows environment
With respect to the documentatio... continue reading
All,
Can someone better than me (i.e anyone) help me resolve the issues with
Pull Request 25220.
I followed the dev guide, but I assume that between me taking my fork of
the cpython repository, and building my pull request, another pull
request was merged into master.
It also appears that the Documentation build is failing with an rst
reference tag error on part of the document I never changed.
I am finding it difficult to drive github to understand how to resolve
the conflict (i.e how ... continue reading
Over the last couple of weeks, we have worked with our designer Jessica
Peña to come up with a logo which reflects both our desire to come
together online during the pandemic and shows how well our community is
interconnected around the world.
Here's our brand new logo for EuroPython 2021 Online:
https://blog.europython.eu/presenting-our-europython-2020-logo/
Hope you like it :-)
We will soon make EuroPython 2021 merchandise available with the new
logo in our EuroPython merch shop, so you ca... continue reading
'U' mode was removed once and resurrected.
https://bugs.python.org/issue39674
As far as I can see, it is postponed to Python 3.10. Am I right?
Can we remove 'U' mode in Python 3.10?
Inada Naoki songofacandy@gmail.com
PyCon ZA 2021 will take place on the 7th & 8th of October, 2021. This
year, due to the ongoing pandemic, PyCon ZA will again be an online
event.
We are looking for the following presentations:
If you would like to give a presentation, please register at
https://za.pycon.org/ and submit your proposal, following the
instructions at https://za.pycon.org/talks/submit-talk/ ... continue reading
We are all familiar with the with statement for context managers, so
that the resources are correctly finalized/closed in case of an
exception either in terms
of the resources being allocated of the processing.
It is very common though to wrap the with block in an outer try
block, since although we know that the resource has been closed, at an
'application' level it is still neccessary
to deal with the exception - an example might be :
try:
with open('config... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/ITNCZD2GOQS7TQF7XYFWFYABDP5ZNS5G/)
In issue14243 [1] there are two issues being tracked:
I'd like to address and get feedback on the context management issue.
from tempfile import NamedTemporaryFile
with NamedTemporaryFile() as fp:
fp.write(b'some data')
fp = open(fp.name())
data = fp.read()
assert data == 'some_data'
Occasio... continue reading
Hello,
I would like to propose adding literal syntax to allow creation of an empty set without the need to call the type constructor. I believe the best choice for such a literal, and one that has been proposed before, is {,}.
I know this idea has surfaced a few times before, but I cannot find any serious consideration since the 3K ideas chain with the closest to a pronouncement here https://mail.python.org/pipermail/python-3000/2006-May/001599.html. In that thread the idea of a new syntax f... continue reading
I was wondering if it might be reasonable to consider adding a set of Greek letters to the constants in the string module. In my mind, the format would follow the existing convention—constants for both greek_lowercase and greek_uppercase, as well as a combined constant greek_letters.
Judging by how these constants are defined in the module, this seems like it might be an almost trivially easy addition (with minimal future maintenance required), and could provide a neat little function... continue reading
Hypertag (http://hypertag.io/ ) is a new language for document generation and HTML templating that has been released recently. Inspired by indentation-based template languages (Slim, Haml, Shpaml), it provides clean, readable syntax, and multiple original features: native custom tags, Python-like imports and control blocks, DOM manipulation, complex expressions, filter pipelines, Django integration, and more... Available on GitHub and PyPI:
ACTIVITY SUMMARY (2021-04-02 - 2021-04-09)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7524 (+19)
closed 48008 (+70)
total 55532 (+89)
Open issues with patches: 2999
#24160: Pdb sometimes raises exception when trying to remove a breakpo
https://bugs.python.org/issue24160 reopened by pablogsal
#39899: `pat... continue reading
PyDev 8.3.0 Release Highlights
External linters
Others
Hi!
I hereby want to announce a small C-Extension we created for an
internal research project. It might be useful to scientists who use 1-
dimensional fourier transforms frequently.
It wrapps the "Fastest Fourier Transformation in the West", or at least
a very small subset of it (currently only the complex 1D transform,
both serial and with MPI, and wisdom handling).
You can find the source code, licensed under GPLv3, here:
https://git.sr.ht/~imperator/mini-mpi-fftw
I have a sourcehut mailing... continue reading
Hi all,
We just released Sphinx-4.0.0b1.
It has many changes including incompatible ones.
Please confirm it working fine on your documents.
In detail, please see CHANGES:
https://github.com/sphinx-doc/sphinx/blob/4.0.x/CHANGES
You can use it with: pip install --pre Sphinx
Since this is a beta release, we expect that you may encounter bugs.
If you find a bug, please file an issue on Github issues:
https://github.com/sphinx-doc/sphinx/issues
Thanks,
Takeshi KOMIYA
Attached is my second draft of PEP 649. The PEP and the prototype have
both seen a marked improvement since round 1 in January; PEP 649 now
allows annotations to refer to any variable they could see under stock
semantics:
Hi,
Please review this documentation:
https://docs.python.org/dev/using/configure.html
If you have comment, you can directly write a PR (please notify me by
mentioning @vstinner in a comment). Or if you prefer, you can reply
directly by email and I will try to address your remarks.
--
Over the last years, the configure script got more and more options. I
was always disappointed by the lack of documentation. It is also
really hard to understand how Python pass compiler and linker files
w... continue reading
Hi,
I have written some classes that represent immutable views on collections (see "immutable-views" package on Pypi).
Currently, these view classes inherit from the abstract collection classes such as Mapping, Sequence, Set. However, they implement the read-only methods of dict, list and set, which provides some more methods compared to the abstract collection classes. For example, class "dict" provides copy() or reversed() and the newer OR-operator methods all of which are not defined on ... continue reading
Wing 7.2.9 adds remote development for 64-bit Raspberry Pi, improves
auto-closing of quotes, optimizes change tracking when large numbers of
project files change at once, improves debugger data display for some
value types, and makes a number of other usability improvements.
Details: https://wingware.com/news/2021-04-12
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerfu... continue reading
Over the years, I've seen version used very broadly but not quite in
all packages. I've always known it was a convention, not a requirement. But
it turns out it's not even a "official" convention.
But it really would be nice if there was a consistent way that I could
count on to get the version of a package at run time.
Turns out this was suggested in PEP 396 -- and deferred almost 13 years ago!
https://www.python.org/dev/peps/pep-0396/
In the status note, it says:
"""
Further explora... continue reading
As part of our PyCon US talk (which will be pre-recorded), the SC would
like to have a Q&A session. Since it's pre-recorded, we figured we'd
collect questions through Slido, which also lets people vote on the
questions: https://app.sli.do/event/qdtzzpmd. The Slido will be open for
questions and voting for a week, after which we'll do our best to answer
them all.
If you're unhappy using Slido I'd also be happy to take questions directly,
but we would like to gauge the popularity of the questions... continue reading
In any Python 3.6 or later, type
>>> x : float = 1
>>> isinstance(x, float)
or replace the second line with
>>> type(x)
As someone who has programmed in FORTRAN, Pascal, C/C++,
Java, and Go this is not at all what I consider reasonable. I do not
believe other programmers with experience in typed languages
would expect this behaviour either.
Having a type checker run before the Python interpreter in our
current day continuous build/integration environment adds a
second step and t... continue reading
Are there any reasons not to make scalar types iterable returning the value ones?
Should each function check if it has got one value or a list/tuple before iteration over the argument?
What is wrong on scalars for iteration, please?
There is even legal to iterate over an empty set – an empty cycle.
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
def chain(*iterables):
... for iterable in iterables:
... yield from iterable
...
a = 5
b = range(3)
for i in chain(a, ... continue reading
Looking for final comments before submitting for SC approval. It would be nice to finally get this resolved. :)
Full text follows.
PEP: 467
Title: Minor API improvements for binary sequences
Version: $Revision$
Last-Modified: $Date$
Author: Nick Coghlan ncoghlan@gmail.com, Ethan Furman ethan@stoneleaf.us
Status: Deferred
Type: Standards Track
Content-Type: text/x-rst
Created: 30-Mar-2014
Python-Version: 3.9
Post... continue reading
I've already asked on python-ideas, but it was suggested that as there's a
PEP already, it's time to move this along. So here's the pitch.
Over the years, I've seen version used very broadly but not quite in
all packages. I've always known it was a convention, not a requirement. But
it turns out it's not even a "official" convention.
But it really would be nice if there was a consistent way that I could
count on to get the version of a package at run time from the package
itself.
Turns ... continue reading
Hi, all.
I am implementing PEP 597. During review, Victor suggested to
deprecate OpenWrapper. OpenWrapper is defined only for
compatibility between C function and Python function:
from _pyio import open as py_open
from _io import open as c_open
class C:
py_open = py_open
c_open = c_open
C().c_open("README.rst") # works
C().py_open("README.rst") # TypeError: expected str, bytes or
os.PathLike object, not C
So builtin open is not io.open, but io.OpenWrapper in Python 3.9... continue reading
This was just posted on SO
https://stackoverflow.com/questions/67083039/why-does-python-return-15-for-0xfor-x-in-1-2-3
I can reproduce it with a simpler example
0xfor 3
15
Is it a bug in the parser, or working as intended? It's not only for
hex. This works to
3or 50
3
--
Kind regards,
Stefano Borini
gzip compression, using class GzipFile from gzip.py, by default
inserts a timestamp to the compressed stream. If the optional
argument mtime is absent or None, then the current time is used [1].
This makes outputs non-deterministic, which can badly confuse
unsuspecting users: If you run "diff" over two outputs to see
whether they are unaffected by changes in your application,
then you would not expect that the *.gz binaries differ just
because they were created at different times.
I'd propos... continue reading
After going through the https://github.com/python/cpython/blob/master/Include/object.h it seems that Py_XDECREF is just calling Py_DECREF if the PyObject pointer is not NULL. This if statement could be directly implemented in Py_DECREF right? Therefore is it really required to have Py_XDECREF? Why not use a DeprecationWarning for now and plan to deprecate Py_XDECREF in the near future?
How about implementing an if statement in Py_DECREF to make it work like Py_XDECREF?
Thanking you,
With Regar... continue reading
I've read the recent discussions
https://mail.python.org/archives/list/python-dev@python.org/thread/QSASX6PZ3LIIFIANHQQFS752BJYFUFPY/#UITB2A657TAINAGWGRD6GCKWFC5PEBIZ
regarding PEP 649 and PEP 563 with interest, Larry Hastings recently
contacted me when prompted
https://mail.python.org/archives/list/python-dev@python.org/message/YKVYJMLUWUVT4KMLUNEQYVBZWNAPR4GV/
to do so in a related discussion.
I maintain pydantic https://pydantic-docs.helpmanual.io/ which uses type
annotations to provid... continue reading
During the last few weeks the team has been hard at work making final
changes to the website, and we are excited to announce the launch of the
conference website for EuroPython 2021 today !
* EuroPython 2021 Conference Website *
https://ep2021.europython.eu/
We have also migrated the accounts from last year's website to the new
one, so you should be able to login right away. That said, we still
recommend changing your password as best practice. If you don't... continue reading
Hi,
I propose to change the -W command line option and the PYTHONWARNINGS
environment variable to use the message as a regular expression in
Python 3.10. Or does anyone have a reason to keep the current behavior
as it is?
I created https://bugs.python.org/issue43862 for this change.
--
Python provides two ways to specify warnings filters:
While the Py... continue reading
Hi all,
I got pinged to voice my opinion on PEP 649 as the instigator of PEP 563. I'm sorry, this is long, and a separate thread, because it deals with three things:
First off, it looks like this isn't worded clearly enough in the PEP itself so let me summarize what the goals of PEP 563 were:
Goal 1. To get rid of the forward reference problem, e.g. when a type ... continue reading
ACTIVITY SUMMARY (2021-04-09 - 2021-04-16)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7522 ( -2)
closed 48086 (+78)
total 55608 (+76)
Open issues with patches: 2993
#37251: Mocking a MagicMock with a function spec results in an AsyncMo
https://bugs.python.org/issue37251 reopened by gregory.p.smith
#40066... continue reading
Hi all.
My apologies if this is a topic that's been discussed already, but I
wasn't able to locate anything in the archive on the subject. I was
wondering if there's a fundamental reason for using
PyThread_get_thread_ident instead of PyThread_get_thread_native_id for
the value of the thread_id field of the PyThreadState object.
The reason why I'm asking is that I would like to have easy access to
the native TID on Linux to identify the /proc/stat file associated
with the thread from an externa... continue reading
Hi,
There has been some discussion on this mailing list about the memory use
of PEP 563 vs PEP 649.
It doesn't matter.
The memory use of either is small, and any measurements are merely
measuring artifacts of the current implementations, and the current
on-disk representation of code objects.
In an ideal implementation, of either PEP, the underlying data for
__annotations__ will sit on disk at zero cost in memory and load time.
There are much more important differences between the two ... continue reading
Hi all,
I currently have a use-case where I need to rely on f_lasti, but it seems
that it's not really possible to rely on it as it doesn't accurately point
to the actual bytecode last executed when PREDICT is used.
So, I'd like to know: is it possible to change that so that the f_lasti
is indeed properly updated (even when PREDICT) is used (to actually match
what the docs say about it: https://docs.python.org/3/library/inspect.html)?
As a note, my use case is doing a step into a function... continue reading
The heart of the debate between PEPs 563 and 649 is the question: what
should an annotation be? Should it be a string or a Python value? It
seems people who are pro-PEP 563 want it to be a string, and people who
are pro-PEP 649 want it to be a value.
Actually, let me amend that slightly. Most people who are pro-PEP 563
don't actually care that annotations are strings, per se. What they
want are specific runtime behaviors, and they get those behaviors when
PEP 563 turns their... continue reading
We're pleased to announce the start of the EuroPython 2021 ticket sales:
* EuroPython 2021 Ticket Sales Open *
https://ep2021.europython.eu/registration/buy-tickets/
For EuroPython 2021, we'll have more than 10 training sessions and
workshops spread across two days. There is a combined ticket available
for those who wish to attend both.
We also added a new livestream-only ticket for getting access to the
live streams... continue reading
Hi everyone,
This is a friendly reminder from the release manager team that Python 3.10
feature freeze is two weeks away (Monday, 3 May 2021).
Please, be aware of the following:
After a first beta release is published, no new features are accepted.
Only bug fixes can now be committed. This is when core developers should
concentrate on the task of fixing... continue reading
Hi everyone,
This is a friendly reminder from the release manager team that Python 3.10
feature freeze is two weeks away (Monday, 3 May 2021).
Please, be aware of the following:
After a first beta release is published, no new features are accepted.
Only bug fixes can now be committed. This is when core developers should
concentrate on the task of fixing... continue reading
How about leveraging the # coding=<encoding name> hook that exists
since 2001 to enable the alternative syntax some are advocating for
type hints?
PEP 263—Defining Python Source Code Encodings
https://www.python.org/dev/peps/pep-0263/
I've seen experiments in the wild using that to support syntax
extensions to Python. Just for fun, years ago I wrote a POC for
Sucuri—a Python dialect with the keywords in Portuguese. The
pre-processor simply replaced the Portuguese keywords with the English
on... continue reading
urllib.urlencode currently uses str() on its non-bytes objects before encoding the result. This causes a
compatibility break when integer module constants are converted to IntEnum, as str(IntEnum.MEMBER) no longer returns
the integer representation; however, format() does still return the integer representation.
The fix is to add a separate branch to check if the argument is an Enum, and use the value if so -- but it got me
wondering: in general, are there differences between calling ... continue reading
Hi everyone,
Once upon a time Python was a purely duck typed language.
Then came along abstract based classes, and some nominal typing starting
to creep into the language.
If you guarded your code with isinstance(foo, Sequence) then I could
not use it with my Foo even if my Foo quacked like a sequence. I was
forced to use nominal typing; inheriting from Sequence, or explicitly
registering as a Sequence.
Then came type hints. PEP 484 explicitly said that type hints were
optional a... continue reading
(Starting a new thread so as not to derail any of the ongoing discussions.)
Thanks, everyone, for your thoughts on Python 3.10 and the impact of PEP
563 (postponed evaluation of annotations) becoming the default. The
Steering Council has considered the issue carefully, along with many of the
proposed alternatives and solutions, and we’ve decided that at this point,
we simply can’t risk the compatibility breakage of PEP 563. We need to roll
back the change that made stringified annotations the d... continue reading
Consider the following snippet:
def foo(a, b):
pass
foo(1, 2, 3)
We all know what will happen.
File "<stdin>", line 4, in <module>
foo(1, 2, 3)
TypeError: foo() takes 2 positional arguments but 3 were given
Would it be reasonable to include the line number for the function foo() that it resolved the call to? I.e. 'File "<stdin>", line 1, in foo'.
There are situations (e.g. monkey patch) where this is not obvious. Would be great detail to include that in the trac... continue reading
Currently format strings (and f-string expressions) support three
conversions: !s -- str, !r -- repr and !a for ascii.
I propose to add support of additional conversions: for int, float and
operator.index. It will help to convert automatically printf-like format
strings to f-string expressions: %d, %i, %u -- use int, %f -- use float,
%o, %x -- use operator.index.
For float the conversion letter is obvious -- !f. But I am not sure for
what !i should be used, for int or operator.index. If make i... continue reading
I am pleased to announce the release of ycecrean 1.3.5.
Do you ever use print() or log() to debug your code? If so, ycecream,
or y for short, will make printing debug information a lot sweeter.
And on top of that, you get some basic benchmarking functionality.
Ycecream is available on GitHub: www.github.com/salabim/ycecream and on
PyPI.
For this who know the icecream package, here's an overview of the
differences:
---------------------------------------------------... continue reading
We are happy to announce the start of our financial aid program for this
year’s EuroPython.
* EuroPython 2021 Financial Aid *
https://ep2021.europython.eu/registration/financial-aid/
As part of our commitment to the Python community and to increase our
reach to lower income countries, we will provide financial aid for
people in need to enable them to attend EuroPython 2021.
Financial Aid Sponsor for EuroPython 2021: The EuroPython Society (EPS)
is sponsoring EUR 1... continue reading
@serhiy Moving my speculative discussion to python-ideas. CC as
courtesy, comment from you is welcome but not necessarily expected.
Serhiy Storchaka writes:
format() without format specifier and str() should return the same
value in general, otherwise it will confuse users.
I think this is a good rule of thumb because it's a very plausible
default for format(), and easy to explain.
But then what is the purpose of format()? Why not just give str() the
functionality of format(), and de... continue reading
I just got the reply below sent directly to my personal account, and I'm
confused about what's going on. If it's just a one off I'll chalk it up to
random internet weirdness, but if other folks are getting these too it
might be something the list admins should look into? Or... something?
---------- Forwarded message ---------
From: Hoi lam Poon gillcovid19@gmail.com
Date: Fri, Apr 23, 2021, 02:01
Subject: Re: [Python-Dev] Re: PEP 654: Exception Groups and except* [REPOST]
To: Nathaniel Smith ... continue reading
ACTIVITY SUMMARY (2021-04-16 - 2021-04-23)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7474 (-48)
closed 48187 (+101)
total 55661 (+53)
Open issues with patches: 2971
#10663: configure shouldn't set a default OPT
https://bugs.python.org/issue10663 reopened by Arfrever
#28254: Add C API for gc.enable, gc.d... continue reading
About 4 months ago, I've created bpo-42725 in order to
resolve some of the points below though I decided to
postpone it for various reasons that blocked it completely
until the point of where we have a beta cut in a week or
so. So I'm asking for comments regarding how should we resolve
this behavior.
Even though PEP 563 blocks having all compiler-related activities
for annotations by behaving them strings, this doesn't happen until
the symbol is constructed which results with different problems... continue reading
First, the SC is postponing considering accepting
https://www.python.org/dev/peps/pep-0646/ any further until Python 3.11.
There's unfortunately not enough time before b1 to get requested updates
into the PEP, discuss the PEP again, approve it, and then review an
implementation thoroughly.
Second, this PEP is proposing new syntax for Python but that detail is
barely touched upon. For instance, there isn't a direct proposal of what
grammar changes that should be made. There's also no discussion ... continue reading
Hi all,
Could someone help take a look at the following PR, which fixes one of the
broken socket module tests that exercises part of the standard library?
PR Link: https://github.com/python/cpython/pull/19548
BPO Link: https://bugs.python.org/issue40297
The test can be run locally on Linux by setting up the virtual SocketCAN
interface the test expects:
sudo modprobe vcan
Think it like this. We have this code in Python :-
def add(a, b):
return a + b
Here we are taking two arguments a, b and then returning a + b. But we can pass in instance of any class like str, int, float, dict, user-defined class, etc. But we only want to add int here. Here we can modify it to be,
def add(a, b):
if type(a) == int and type(b) == int:
return a +b
raise Exception("Error")
In this example it's pretty easy to check if the arguments are int. But in real world ... continue reading
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.6.3, which is a bug fix release.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.6.3
https://github.com/scipy/scipy/releases/tag/v1.6.1
One of a few ways to install this release with pip:
pip install scipy==1.6.3
SciPy 1.6.3 is... continue reading
Ref. https://bugs.python.org/issue43908, I've compiled a list of types that have been converted to heap types. I've posted it on Discourse for readability:
https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403
Note: for now, I didn't bother to trace PyType_Spec variable names to complete type names. Hope it's not too much of a problem.
Erlend
Here's the plain text version:
0b858cdd5d 2021-01-04 Modules/cjkcodecs/multibytecodec.c
- multibytecodec_spec
- ... continue reading
We're happy to announce the EuroPython 2021 Call for Proposals (CFP) and
are accepting proposals for talks, training sessions, workshops, panels,
poster sessions, helpdesks and other interactive sessions at EuroPython
2021.
* EuroPython 2021 Call for Proposals (CFP) *
https://ep2021.europython.eu/events/call-for-proposals/
We will leave the CFP open from today until
Sunday, May 9, 23:59:59 CEST.
To submit a proposal, please log in to the site (o... continue reading
Hi everyone,
This is the last friendly reminder from the release management team that
Python 3.10 feature freeze is a week away (Monday, 3 May 2021).
Some important things to have in mind:
https://bugs.python.org/issue43908
https://bugs.python.org/issue43933
https://bugs.python.org/issue43916
If you want to help making sure that the release is on time, help us
resolving those blockers. You can also search the ... continue reading
Hi Mario,
The Python Steering Council today decided that we will defer consideration of PEP 648 to Python 3.11. On March 30, 2021 we sent the following feedback to you via python-dev, which began a discussion thread:
We on the SC extend our thanks again for the PEP, and encourage you to continue to work on this PEP for pronouncement in Python 3.11.
Cheers,
-Barry
(on behalf of the Python St... continue reading
Thanks to everyone for your patience as we worked to get the Docs Workgroup
off the ground.
As you may have remembered, Carol Willing and Ned Batchelder brought
forward the topic of CPython Documentation
https://pyfound.blogspot.com/2020/04/cpython-documentation-next-5-years.html
at last year's Python Language Summit.
The topic has been further discussed at last year's virtual Python core
dev's sprint, and Carol has worked on the Docs WG charter
<https://docs.google.com/document/d/175bjJA7hK... continue reading
Hi everyone,
There are a couple of uncompleted asyncio feature removals scheduled
for 3.9 and 3.10 releases.
It will be great if we either complete them or reschedule before the
3.10 feature freeze. There are two stale pull requests related to
this.
Removal of @asyncio.coroutine in version 3.10 deprecated since version 3.8
Documentation: https://docs.python.org/3.10/library/asyncio-task.html#asyncio.coroutine
Issue deprecating the decorator: https://bugs.python.org/issue36921
Issue for the rem... continue reading
Re https://bugs.python.org/issue40608.
I think it will be an act of kindness to
deprecate Py_TRASHCAN_SAFE_BEGIN/END in 3.10 and tell people to use
Py_TRASHCAN_BEGIN/END
instead.
TL;DR: There was a change in 3.8 that introduced the latter while leaving
the former for backwards compatibility, but also inadvertently breaking
them. This is not an easy bug to deal with in the wild, we found it because
we have a unit test in our codebase referencing https://
bugs.python.org/issue16602. A deprecati... continue reading
I was surprised recently to discover that BZ2File (at least in 3.7) doesn't have a name attribute. Is there some fundamental reason name couldn't be supported, or is it just a bug that it wasn't implemented?
Hi,
Code snippet 1 and 2 convert an hex to float, but the SNaN is changed to QNaN automatically. It follows IEEE 754 behavior.
While Code snippet 3 converts an hex to double, and the SNaN keeps.
Is there any solution to keep SNaN float unchanged in Code snippet 1 and 2?
i = int('7f800001', 16)
cp = pointer(c_uint32(i))
fp = cast(cp, POINTER(c_float))
print(fp.contents.value) # nan
print(struct.pack(">f", fp.contents.value).hex())
7fc00001
f = struct.unpa... continue reading
In the EuroPython community, diversity and inclusion are one of our core
values. Therefore, we are launching a Speaker Mentorship Program in this
year's edition.
* EuroPython 2021 Speaker Mentorship Program *
https://ep2021.europython.eu/events/call-for-proposals/
We know how tough it is to prepare for a talk, find & organize the right
content around the topic and more so when it's the first time. So what
could be better than getting guidance and support from within the
co... continue reading
There’s been a bit of discussion on the reliability of getting other users'
home directories via os.path.expanduser(), mostly on issue42998
https://bugs.python.org/issue42998.
In msg390503 https://bugs.python.org/issue42998#msg390503, Serhiy
Storchaka pointed out that ntpath only makes an educated guess of other
user’s home directories.
In msg390535 https://bugs.python.org/issue42998#msg390535, Eryk Sun
supplied an improved ntpath implementation that makes use of winreg and
ctypes.
In m... continue reading
I have released v0.3.4 of the orderedstructs package that contains a high
performance SkipList implemented in C++ with Python bindings. A SkipList
behaves as an always sorted list with, typically, O(log(n)) cost for
insertion, look-up and removal. This makes it ideal for such operations as
computing the rolling median of a large dataset.
The characteristics of this SkipList implementation include:
Hello,
I've merged the main part of PEP-652 implementation. The Limited C API
(introduced in PEP 384 and used for extension modules that work across
Python versions without recompilation) is now explicitly defined and
better tested.
When changing/extending the limited API:
An excerpt from bpo-31369: re.RegexFlag and __all__
One thing I discovered when developing this example: there doesn't seem to be a flag to
represent 0 (zero), i.e. "no flags". And foo(0) is a type error (even though it works
fine at runtime).
Which raises the question: Do we want to have a standard name for stdlib Flags when no flags are set?
What should we call it?
NONE
ZERO
EMPTY
???
--
~Ethan~
When one writes one's "blurb" for the changelog, in what tense should it
be? I mostly see entries in present tense:
bpo-43660: Fix crash that happens when replacing sys.stderr with a
callable that can remove the object while an exception is being
printed. Patch by Pablo Galindo.
bpo-41561: Add workaround for Ubuntu’s custom OpenSSL security level
policy.
But occasionally I see entries in past tense:
bpo-26053: Fixed bug where the pdb interactive run co... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/SUEPLPRN2IY7EGC7XBLWWN2BOLM3GYMQ/)
Greetings,
A proposal to change the theme of the
Python docs. Great softwares are not
distinguished by docs crankiness and
unpleasantness.
Though what's more important is the
content, nevertheless it can be made
more enjoyable to read.
The Masonite docs for example is quite
nice:
https://docs.masoniteproject.com/
Kind Regards,
Abdur-Rahmaan Janhangeer
about https://compileralchemy.github.io/ | blog
https://www.pythonkitchen.com
github https://github.com/Abdur-RahmaanJ
Mauritius
I propose a syntax for constructing/filtering strings analogous to the one
available for all other builtin iterables. It could look something like
this.
dirty = "f8sjGe7"
clean = c"char for char in dirty if char in string.ascii_letters"
clean
'fsjGe'
Currently, the best way to do this (in the general case) seems to be the
following.
clean = "".join(char for char in dirty if char in string.ascii_letters)
But I think the proposed syntax would be superior for two main reasons.
... continue reading
ACTIVITY SUMMARY (2021-04-23 - 2021-04-30)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7453 (-21)
closed 48273 (+86)
total 55726 (+65)
Open issues with patches: 2968
#42737: PEP 563: drop annotations for complex assign targets
https://bugs.python.org/issue42737 reopened by BTaskaya
#43926: Clean metadata ... continue reading
Hi,
I want to use this encoding
https://github.com/vanangamudi/tace16-utf8-converter/blob/master/tace16.py[1]
for Tamil language text because it is more consistent with the language's
nature, and Unicode encoding severely damages(read more here[2]
https://en.wikipedia.org/wiki/Tamil_All_Character_Encoding) the intrinsic
features of the fusion of alphabets.
a specific example would be when dealing with regex. '^[சிகு]' is the
intended expression for lines that starts with either 'சி' or '... continue reading
I was actually thinking about this before the recent "string comprehension"
thread. I wasn't really going to post the idea, but it's similar enough
that I am nudged to. Moreover, since PEP 616 added str.removeprefix() and
str.removesuffix(), this feels like a natural extension of that.
I find myself very often wanting to remove several substrings of similar
lines to get at "the good bits" for my purpose. Log files are a good
example of this, but it arises in lots of other contexts I encounte... continue reading
The way it works today, if you have an application embedding Python, your
sys.argv[0] is (likely) your main executable and sys.executable is probably
None or the empty string (per the stdlib docs which say not to set
sys.executable if there isn't a path to a known python executable).
Unfortunately, since sys.executable is a str, the executable it points to
must behave as python does. This means that your application embedding
and distributing its own Python must provide a python or `pytho... continue reading
Hi all!
So this is a proposal for a new soft language keyword:
namespace
I started writing this up a few hours ago and then realized as it was
starting to get away from me that there was no way this was going to be
even remotely readable in email format, so I created a repo for it instead
and will just link to it here. The content of the post is the README.md,
which github will render for you at the following link:
https://github.com/matthewgdv/namespace
I'll give the TLDR form here, but I ... continue reading
Recently there's been some discussion around string comprehensions, and I wanted to look at a specific variant of the proposal in a bit more detail.
Original thread: https://mail.python.org/archives/list/python-ideas@python.org/thread/MVQGP4GGTIWQRJTSY5S6SDYES6JVOOGK/
Let's say i have a matrix of numbers:
matrix = [[randint(7, 50) / randint(1, 3) for _ in range(4)] for _ in range(4)]
I want to format and display each row so that the columns are nicely lined up. Maybe also display the sum of t... continue reading
Hi,
I've been working on visualizing some data on Python in Gentoo, and made
a timeline of Python releases as a side result. I've figured some of
you might be interested, so I've decided to share it. The result:
https://mgorny.pl/python-timeline.html
Script: https://github.com/mgorny/gpyutils/blob/master/timeline.py
Data: https://github.com/mgorny/gpyutils/blob/master/timeline.toml
I've (roughly) covered the versions between 2.5 and 3.10 (2.5 is
the oldest I've seen during my... continue reading
I'm happy to announce the release of Pygments 2.9. Pygments is a
generic syntax highlighter written in Python.
Pygments 2.9 provides over half a dozen new lexers, various improvements
to existing lexers and some small styling tweaks. Please have a look at
the changelog https://pygments.org/docs/changelog/.
Report bugs and feature requests in the issue tracker:
https://github.com/pygments/pygments/issues. Thanks go to all the
contributors of these lexers, and to all those who rep... continue reading
Hi everyone,
Unfortunately, the CI for master is currently quite unstable and he had
some problems that we
have been fixing all weekend and today. We are doing our best to stabilize
the test suite and making
sure that everything is ready to go for the release with no issues, but
this will take some time (also
bear in mind that today is a bank holiday in the UK, so I am doing my best
to get the release ready
in a holiday). Given this and the fact that we need to do a branch rename,
**we have dec... continue reading
This has been a very busy day for releases and on behalf of the Python development community we’re happy to announce the availability of three new Python releases.
Python 3.10 is now in Beta
Get it here: Python 3.10.0b1 https://www.python.org/downloads/release/python-3100b1/
Python 3.10 is still in development. 3.10.0b1 is the first of four planned beta release previews. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and... continue reading
This has been a very busy day for releases and on behalf of the Python development community we’re happy to announce the availability of three new Python releases.
Python 3.10 is now in Beta
Get it here: Python 3.10.0b1 https://www.python.org/downloads/release/python-3100b1/
Python 3.10 is still in development. 3.10.0b1 is the first of four planned beta release previews. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to p... continue reading
I have two pull requests against my cpython fork from a dependabot -- what is that, and should I merge them?
--
~Ethan~
pytest 6.2.4 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
Most of programming languages out there have switch-case statements. Python doesn't have support for switch-case statements though. switch-case statements can sometimes be nice and tidy and sometimes it may be a horrible nightmare. But that also applies to if-elif-else statements. It would be nice to have switch-case statements support in python.
switch expr:
case expr2:
case expr3:
statements
default:
statements
How should ... continue reading
Private methods, functions and variables are very common in programming languages. But Python doesn't support private. It has conventions for naming so considered private but not private. Most of the time private is never required, what Python provides is more than enough. But the need for private come into place when we're dealing with passphrases and servers. For example consider this code,
class A:
def get():
// code to get the password
self.password = password
Now consi... continue reading
I'm looking through the documentation, and not finding any good
reference for type hints for class_getitem in the collections.abc
module.
I do see some of it covered in the typing module documentation, but
those are deprecated, and some are somewhat cryptic (e.g. Coroutine).
Make sense to open a BPO and start a PR for doc updates?
Paul
Hi everyone,
I am extremely excited to announce the release of attrs 21.1.0.
attrs is the direct ancestor of – and the inspiration for – dataclasses in the standard library and remains the more powerful option for creating regular classes without getting bogged down with writing identical boilerplate again and again: https://www.attrs.org/
(for a richer version of this e-mail, check out https://github.com/python-attrs/attrs/releases/tag/21.1.0)
Heartfelt thanks go to my generous GitHub spo... continue reading
We're happy to announce our call for sponsors. Reach out to enthusiastic
Python developers, users and professionals worldwide by presenting your
company at this year’s EuroPython 2021 Online conference, from July 26 -
Aug 1, 2021!
* EuroPython 2021 Call for Sponsors *
https://ep2021.europython.eu/sponsor/
Sponsoring EuroPython guarantees you highly targeted visibility and the
opportunity to... continue reading
(Sorry, this is probably not really python-dev material, but I'm stuck
trying to bring my fork into sync with python/cpython.)
I don't know if I did something to my fork or if the master->main
change did something to me, but I am unable to sync my
smontanaro/cpython main with the python/cpython main. The dev guide
gives this simple recipe:
git checkout main
git pull upstream main
git push origin main
Here's how that goes:
(python39) rvm% git co main
Already on 'main'
Your branch is up to dat... continue reading
PyScripter is a free and open-source Python Integrated Development Environment (IDE) created with the ambition to become competitive in functionality with commercial Windows-based IDEs available for other languages. It is feature-rich, but also light-weight.
New features:
It's tedious to add classes one by one using PyModule_AddObject in PyInit_module function. Wouldn't it be much easier if there's a slot that has an array of all the classes in their PyObject form and it'll automatically add those classes. Since this is a backwards compatibility change it'll be best if a macro (like PY_AUTO_OBJECT maybe?) is defined then it'll add those classes automatically. If the slot is NULL or 0 then don't add anything. But yeah they may add more classes if they want but it ... continue reading
ACTIVITY SUMMARY (2021-04-30 - 2021-05-07)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7428 (-25)
closed 48377 (+104)
total 55805 (+79)
Open issues with patches: 2946
#40943: PEP 353: Drop support for PyArg_ParseTuple() "#" formats when
https://bugs.python.org/issue40943 reopened by methane
#43001: pytho... continue reading
PEP 501 was deferred because more learning and time was wanted after
introducing f-strings. Now that it has been 5 years, I wonder what the
possibilities of revisiting PEP 501 are.
I recently had the experience of using javascript "tagged template
literals" and was able to build a SQL string parser that is impossible to
have SQL injection with. This is done by having the database connection
object only accept a certain type of object, and all sql tagged template
literals become that object. Bec... continue reading
Hi there,
We are preparing a PEP and we would like to start some early discussion
about one of the main aspects of the PEP.
The work we are preparing is to allow the interpreter to produce more
fine-grained error messages, pointing to
the source associated to the instructions that are failing. For example:
Traceback (most recent call last):
File "test.py", line 14, in <module>
lel3(x)
^^^^^^^
File "test.py", line 12, in lel3
return lel2(x) / 23
^^^^^^^
File... continue reading
It’s with great pleasure that I announce that python-docs-theme has been released to PyPI.
Thanks to the hard work and patience of Olga Bulat, @obulat, Python’s doc theme is now responsive. Many thanks to everyone who has contributed to this release by filing issues, writing PRs, reviewing PRs, and testing the theme. It was a great team effort.
Here are the highlights from the CHANGELOG.rst:
That's this bit:
except (A, B):
^^^^^^
bpo-43149 currently calls it an "exception group", but that conflicts with PEP 654 -- Exception Groups and except*
>>> try:
... pass
... except A, B:
... pass
Traceback (most recent call last):
SyntaxError: exception group must be parenthesized
some alternatives:
exception classinfo must be parenthesized (classinfo so named from the parameter to issubclass)
exception sequence must be parenthesized
... continue reading
Author: Pablo Galindo pablogsal@python.org,
The idea is to allow a "typing=False" keyword argument to the "help"
built-in.
Sometimes a function has dozens of parameters, and several of them are
Union, Optional, or have some container specification, etc.., so the type
description can be way too long, but if one just wants to know if a
parameter with some specific name exists, all the typing stuff would be
just clutter.
Instead of "help(httpx.request)", "help(httpx.request, typing=False)" would
show the same without the typing annotation ... continue reading
Hi all,
I'm delighted to announce the release of Sphinx 4.0.0 final, now available on
the Python package index at https://pypi.org/project/Sphinx/.
It includes many changes including incompatible ones.
Please confirm it working fine on your documents.
In detail, please see CHANGES:
https://github.com/sphinx-doc/sphinx/blob/4.0.x/CHANGES
Thanks to all collaborators and contributers!
Sphinx is a tool that makes it easy to create intelligent and beautiful
documentati... continue reading
Hi,
We have prepared a PEP with our proposal for fine-grained error locations
in tracebacks. You can find the PEP here:
https://www.python.org/dev/peps/pep-0657/
The discussion is happening in the discourse server:
https://discuss.python.org/t/pep-657-include-fine-grained-error-locations-in-tracebacks/8629
To avoid splitting the discussion, please redirect your comments there
instead of replying to this thread.
Thanks!
Regards from sunny London,
Pablo Galindo Salgado
now that python2.7 is EOL, it might be worth resurrecting this syntax as discussed in https://www.python.org/dev/peps/pep-3100/#id13
eg, python 3.11 could support
try:
...
except (E1, E2, E3) as e:
...
as equivalent to
try:
...
except E1, E2, E3 as e:
...
see also https://mail.python.org/archives/list/python-dev@python.org/thread/HSN6ESRB4BD6IUIPKLMNP4TPBQPWHBFK/
Trac 1.4.3, the latest maintenance release for the current stable
branch, is available.
You will find this release at the usual places:
https://trac.edgewall.org/wiki/TracDownload#Trac14StableRelease
You can find the detailed release notes for 1.4.3 on the following
pages:
https://trac.edgewall.org/wiki/TracChangeLog
https://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.4#MaintenanceReleases
Now to the packages themselves:
URLs:
https://download.edgewall.org/trac/Trac-1.4.3... continue reading
Hi pythraners,
/pythran is an ahead of time compiler for high-level scientific kernels written in Python./
I did a quick release of the pythran compiler today. It's only a few months since the
previous release, but this one fixes an important memory leak with transposed arguments,
so here it comes.
Changelog: https://github.com/serge-sans-paille/pythran/blob/0.9.10/Changelog
On Github: https://github.com/serge-sans-paille/pythran/tree/0.9.10
On Pypi: https://pypi.org/project/pythran/
Releas... continue reading
Hi, folks.
Now Python 3.11 development is open and I am removing some deprecated
stuffs carefully.
I am considering configparser.ParseError.filename property that is
deprecated since Python 3.2.
https://github.com/python/cpython/blob/8e8307d70bb9dc18cfeeed3277c076309b27515e/Lib/configparser.py#L315-L333
My random thoughts about it:
We've decided to extend the deadline for our Call for Proposals until
Sunday, May 16, 23:59:59 CEST. We are still looking for a few more
proposals, especially for posters, training sessions, and helpdesks.
For more information about submitting a proposal, you can read the
original blog post announcing the Call for Proposals:
https://blog.europython.eu/europython-2021-call-for-proposals-open-cfp/
To submit a proposal directly, please log in to the site (or create an
account first) and then pro... continue reading
Trac 1.5.3, the latest development release leading up to Trac 1.6, is
available.
You will find this release at the usual places:
https://trac.edgewall.org/wiki/TracDownload#LatestDevRelease
You can find the detailed release notes for 1.5.3 on the following
pages:
https://trac.edgewall.org/wiki/1.5/TracChangeLog
https://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.5#MaintenanceReleases
Now to the packages themselves:
URLs:
https://download.edgewall.org/trac/Trac-1.5.3.tar.g... continue reading
Hey all,
In these last few months, I have been in the process of healing from some
pretty heavy past trauma. And now that I am on the road to recovery, I want
to share my journey with the Python community in hopes that it may reach
those that are struggling with their own mental health battles, as many of
us are during these dark and difficult times.
Trigger warning that it includes a decent amount of highly personal
content, so only check it out if you are okay with that:
https://discuss.pyth... continue reading
Perhaps Off Topic, but for a good cause.
This year I met Jana Scroeder, a blind person forced to change jobs as part
of the social cost of Covid. Her outsider experience of computer coding
training became a wish to make things better. She has applied for a Holman
Prize ($25,000 over a year) to fund this. She's also set up a survey to
reach and know better those with similar wishes.
One simple way to help open to many is to volunteer to be a sighted helper
for a code and math variant of BeMyEye... continue reading
I don't know how many people will remember some work that David Beazley did about a decade ago on how the GIL impacts multithreading performance - essentially he instrumented the Python interpreter to log how multiple threads competed for the GIL and gave several presentations over the space of 2-3 years. A couple of years ago I reached out to him with an idea on how to significantly improve the way that Python handles multi-threading hand-off of the GIL, but unfortunately he was not interested... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.20.3. NumPy 1,20.3 is a bugfix release containing several fixes merged to
the main branch after the NumPy 1.20.2 release. The Python versions
supported for this release are 3.7-3.9. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.20.3/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.20.3. Linux users will
ne... continue reading
Hi everyone,
Now that we are in the beta period for 3.10 is very important that we make
sure that all
improvements, new APIs and deprecations are reflected in the 3.10 what's
New document.
IMPORTANT!!
If you have worked on:
Please, make sure is reflected on the What's new document for Python 3.10.
Users normally don't
read the c... continue reading
I am pleased to announce the availability of beta release 0.5.0 of
the "plum-py" package. While this release contains many breaking changes,
the API should now remain relatively stable until the anticipated 1.0.0
release expected later this year.
This pure Python package provides classes and utility functions to
transform byte sequences into Python objects and back. While similar
in purpose to Python's standard library struct module, this
package provides a larger set of format spec... continue reading
Hi,
PEP 234 mention
https://sourceforge.net/p/python/mailman/python-iterators/ but the
project mailing list archives are marked as "hidden".
Looks like projects admin and developers can get the "hidden link", but
I think it would be nice to "unhide" the archives if someone is still
admin there and if it's possible, to "unbreak" the link from the PEP.
Hi ,
I created issue44097 for build enhancement: “add configure option to control the groups of .pyc files to install” and PR 23920 for the solution. From the only a few of comments I’ve got, someone thinks this enhancement makes sense. However, someone expressed opposition to this. So what is your opinion on this PR? Necessary or not? I want to hear more views on this. Thanks.
https://bugs.python.org/issue44097
https://github.com/python/cpython/pull/23920
Thanks,
Peixing
Hi everyone,
I would like to present PEP 659.
This is an informational PEP about a key part of our plan to improve
CPython performance for 3.11 and beyond.
For those of you aware of the recent releases of Cinder and Pyston,
PEP 659 might look similar.
It is similar, but I believe PEP 659 offers better interpreter
performance and is more suitable to a collaborative, open-source
development model.
As always, comments and suggestions are welcome.
Cheers,
Mark.
Links:
Hi everyone!
I've just read about pattern matching in Python 3.10, and it sounds really nice.
I've also found out that Rust supports ranges in pattern matching.
https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html#matching-ranges-of-values-with-
fn main() {
let x = 5;
match x {
1..=5 => println!("one through five"),
_ => println!("something else"),
}
}
Can we have something similar please? I think this would be a nice addition to Python's pattern matching.
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 there a convention on how such... continue reading
Talk voting is your chance to tell us what you’d like to see at
EuroPython 2021. We will leave talk voting open until:
Sunday, May 23, 23:59:59 CEST
In order to vote, please log in to the website and navigate to the talk
voting page:
* EuroPython 2021 Talk Voting *
https://ep2021.europython.eu/events/talk-voting/
Any registered attendee of EuroPython 2021 with a paid ticket, as well
as attendees of... continue reading
Hi everyone,
I fully agree with the rationale for the PEP, better error messages
always help.
However, I think the proposed implementation could be misleading in some
cases and wastes memory.
The main problem with PEP 657, IMO, is that it wants to present the
location of an error as a pair of positions, but without the line number
of the second position.
Consequently it ends up with one and a ... continue reading
Hello,
We have decided to extend our Call for Proposals (CFP) deadline for
talks and workshops until May 22nd, 23:59 UTC+5:30.
If you were worried you would not be able to submit your proposal on
time, you now have some more days to do it now.
For more details on how to submit a proposal, you can checkout the
initial blogpost on announcing call for proposals:
https://in.pycon.org/blog/2021/cfp-announcement.html
Not sure how to submit the proposals or worried about mistakes, please
do checkout... continue reading
Hi List,
some days ago I posted about my idea let integer division result in fractions, not floats. The upshot of the discussion was that it is a pity that we do not have literals for fractions, but that there is nothing to do about it, as all proposed syntaxes were a bit ugly.
But why do we need to have different syntax for both, isn't it possible to simply do both at the same time? The interesting answer is: yes. So my proposal is: number literals (which are not integers) are both fractions ... continue reading
The SC has just published the community update for March:
https://github.com/python/steering-council/blob/main/updates/2021-03-steering-council-update.md
We're still trying to get these done every month, but between the rush of
PEPs and other issues before the 3.10b1 deadline, and PyCon US, we're
delayed a little. (The April update hopefully won't be too long.) In the
meantime, the SC keynote from PyCon US covers our longer-term plans and our
points of view on a few other subjects, and that wi... continue reading
Hi list,
as you might have noticed, I am trying to improve the syntax and semantics for symbolic math in Python. Until now, I have to say, my ideas were not that well received, but I learned from the discussion and maybe this time I come up with something people like.
To frame the problem, let us try to solve the equation x ** 2 == 1/2 using sympy:
>>> from sympy import Eq, solve, symbols, S
>>> x = symbols("x")
>>> solve(Eq(x**2, S(1)/2))
[-sqrt(2)/2, sqrt(2)/2]
that worked... continue reading
What is cx_Oracle?
cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.
Where do I get it?
https://oracle.github.io/python-cx_Oracle
The easiest method to install/upgrade cx_Oracle is via pip as in
python -m pip install cx_Oracle --upgrade
What's new?
See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/lates... continue reading
The Python Developers Guide specifically states to get VS2017 for developing
or enhancing python on a Windows system.
Is it still correct to specifically use VS2017 , or is VS2019 also
acceptable?
I ask this because I know that the *.vcproj files and other
build-environment files have changed format pretty dramatically over the
many releases of VS. If a potential new contribution targeted for current
and future python will require new build environment files, I wouldn't want
to have to ... continue reading
I am pleased to announce the availability of beta release 0.6.0 of
the "plum-py" package.
This pure Python package provides classes and utility functions to
transform byte sequences into Python objects and back. While similar
in purpose to Python's standard library struct module, this
package provides a larger set of format specifiers and is extensible,
allowing you to easily create complex ones of your own.
Docs: https://plum-py.readthedocs.io/en/latest/index.html
PyPi: https://... continue reading
ACTIVITY SUMMARY (2021-05-14 - 2021-05-21)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7452 (+23)
closed 48492 (+51)
total 55944 (+74)
Open issues with patches: 2965
#39950: Add pathlib.Path.hardlink_to()
https://bugs.python.org/issue39950 reopened by barneygale
#42834: [subinterpreters] Convert "global" ... continue reading
I'm having a hard time debugging some virtual machine code because GDB
won't break where it's supposed to. Here's my breakpoint #2:
2 breakpoint keep y 0x00005555556914fd
ceval_reg.h:_PyEval_EvalFrameDefault:TARGET_JUMP_IF_FALSE_REG
breakpoint already hit 1 time
p/x oparg
p (oparg >> 16) & 0xff | (oparg >> 8) & 0xff
p oparg & 0xff
p *fastlocals@4
but when it breaks, it's not at the beginning of the case (that is, where
the TARGET_JUMP_IF_FALSE_REG la... continue reading
I propose to add a get_deep(*args, default=_sentinel) method to dict.
It can accept a single argument, that must be an iterable, or multiple
arguments.
The first element must be a key of the dict. If there's not a second
element, the value is returned. If it's present, it tries to use it as
an argument for the eventual getitem() of the value object, and so
on.
In this process, if a KeyError, an IndexError or a TypeError is
raised, if default is set its value is returned, otherwise the
exc... continue reading
Sometimes, we need to execute a statement, which might throw an exception
and we want to return None if it causes an exception. In short, we want to
run that command as failsafe mode, so that it doesn't cause abnormal
termination in case of any exception.
Approach till now:
def log_to_telegram(text):
''' Suppose you want to send some log to some telegram channel using
telegram bot api. It might raise Network Error, or Invalid Bot token error.
'''
send_message(CHANNEL, BOT_TOKEN, ... continue reading
mimedecode
WHAT IS IT
Mail users, especially in non-English countries, often find that mail
messages arrived in different formats, with different content types, in
different encodings and charsets. Usually this is good because it allows
us to use appropriate format/encoding/whatever. Sometimes, though, some
unification is desirable. For example, one may want to put mail messages
into an archive, make HTML indices, run search indexer, etc. In such
situations... continue reading
Many times a programmer would want a variable that will be a constant. The programmer could have been careless and suddenly changed a very important variable. Proposed syntax,
constant variable = 10
variable = 20 # Error
Now constant means making a variable value immutable. It means now we can neither change the variable to point to another value nor the value itself anymore. For example, if we have a list we cannot change it. If we try to then "Error". So for lists,
constant variable = ["Lis... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.0rc1. The highlights are
PCG64DXSM bitgenerator for random numbers.This NumPy release is the result of 561 merged pull requests contributed by
171 people. The Python versions supported for this release are 3.7-3.... continue reading
with the addition of PEP 634 and the new match/case syntax in python 3.10, it seems fitting to be able to use these new match statements inside of expressions as well, which is why I think we should have a new matches keyword (similar to if/else, is, for, not, etc.) for use in expressions. This makes many more complex if/else statements much less complex (see example use cases at #2), and overall looks much more pythonic in practice. The expression would be higher on the order of operations th... continue reading
Hi,
Tomorrow is the scheduled release of Python 3.10 beta 2 but unfortunately
we have several release blockers:
https://bugs.python.org/issue41282: Deprecate and remove distutils
https://bugs.python.org/issue40222: "Zero cost" exception handling
https://bugs.python.org/issue42972: [C API] Heap types (PyType_FromSpec)
must fully implement the GC protocol
https://bugs.python.org/issue44043: 3.10 b1 armhf Bus Error in hashlib
test: test_gil
We also have the address sanitizer buildbot failing :
... continue reading
Variable decorators have been suggested here before, as have new statements
that could also achieve the same level of access to the binding name.
However
I propose a much more restricted syntax that would make for less edge cases
where what is actually passed to the decorator callable may be ambiguous.
Basically this would add syntax to python that would transform
@decorator("spam this") variable
into
variable = decorator("variable", "spam this")
The decorator would be limited to being on the ... continue reading
Hello,
Python 3.10 comes with the built-in anext() but I think we may be missing
some other equivalent built-in functions like list and enumerate.
I didn't discuss the idea of creating a PEP for this but I would like to
get some help with the implementation.
The equivalent Python code would be
async def aenumerate(sequence, start=0): n = start async for elem in
sequence: yield n, elem n += 1
The code for enumerate if here
https://github.com/python/cpython/blob... continue reading
Flat is better than nested.
I remember being confused a lot when I was learning how to write my first decorator. Now eight years later, with the last two spent full-time writing Python, I introduced a bug in production because I forgot to return the inner function from within a decorator.
By introducing multiple parameter lists when defining a function, Scala does a great job at improving readability for curried functions (https://docs.scala-lang.org/tour/multiple-parameter-lists.html).
In... continue reading
I posted my previous idea regarding this on the mailing list. This idea is a little different. This idea suggests introducing constant name bindings. This is similar to const pointer in C/C++. Once a name has been assigned to a data we can change the data (if mutable) but we cannot change the name to point to a different data. The only way the data the constant points can get deallocated is if it goes out of scope, the program exits or the constant is manually del by the user. The proposed syn... continue reading
Hi,
The #python-dev IRC channel moves from Freenode to Libera Chat:
https://libera.chat/ I'm connected as vstinner, see you there ;-) Join
the channel if you would like to talk about the development of Python
itself (the VM, bytecode, stdlib, etc.)!
Moreover, bots notifications (GitHub, buildbots, bugs.python.org) are
now in a new dedicated channel #python-dev-notifs so humans can talk
together again! :-) The migration is on-going, right now some
notifications are still on Freenode.
--
Yeste... continue reading
On Wed, May 26, 2021 at 7:54 AM Steven D'Aprano steve@pearwood.info wrote:
On Wed, May 26, 2021 at 01:33:07PM +0200, Stéfane Fermigier wrote:
Last point that I like in the decorator syntax: it's
I can compose N different decorators and keep the intent obvious:
@acl(READ, WRITE)
@constraint(10 < _ < 100)
@not_null
@indexed
@depends_on(whatever)
@inject
@...
first_name: strHmm, that's a good point.
On the other hand, it would be terri... continue reading
Lot of programming languages have something known as static variable storage in functions not classes. Static variable storage means a variable limited to a function yet the data it points to persists until the end of the program. Well Python also kind of has that functionality. Python's default values provide the same type of functionality but it's a hack and also problematic because only mutable types that are mutated persists. Static should behave much like Python's for loop variables... continue reading
Greetings!
The Flag type in the enum module has had some improvements, but I find it necessary to move one of those improvements
into a decorator instead, and I'm having a hard time thinking up a name.
What is the behavior? Well, a name in a flag type can be either canonical (it represents one thing), or aliased (it
represents two or more things). To use Color as an example:
class Color(Flag):
RED = 1 # 0001
GREEN = 2 # 00... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/C4JRARG6RZKRJCD7745JIK6ZMFRYM76M/)
Greetings!
The Flag type in the enum module has had some improvements, but I find it necessary to move one of those improvements
into a decorator instead, and I'm having a hard time thinking up a name.
What is the behavior? Well, a name in a flag type can be either canonical (it represents one thing), or aliased (it
represents two or more things). To use Color as an example:
class Color(Flag):
RED = 1 # 0001
GREEN = 2 # 00... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/RGZU4QAP4SXVQUJPRJF6FMN45E22U4XL/)
Hi,
In the 3.10 branch, it became really hard to merge PRs because the
following ssl crashs on Windows:
https://bugs.python.org/issue44252
It has a failure rate 1/2 (on average) on the "Windows x86" and
"Windows x64" jobs of GitHub Action and on the Win32 and Win64 jobs of
the Azure Pipelines. I failed to reproduce it on an up to date Windows
10 with an up to date Visual Studio 2019.
I cannot say if it's a race condition, if it's a bug in Python, if
it's a bug in the tests (it sounds unlikely... continue reading
ACTIVITY SUMMARY (2021-05-21 - 2021-05-28)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7424 (-28)
closed 48574 (+82)
total 55998 (+54)
Open issues with patches: 2945
#44209: urllib.robotparser fail on Disallow: /? from google.com
https://bugs.python.org/issue44209 opened by karl.pradene
#44210: Make impor... continue reading
There's been a discussion in this list on extending Python to provide
SYNTAX such as
@decorator
name = EXPRESSION
and also suitable semantics. (Here 'name' is an identifier, in the
discussion called a 'variable'.)
This post is about providing SEMANTICS for such decorator syntax. We can do
this within the existing Python syntax for decorators.
Recall that
@decorator
def fn(....):
# body
is usually equivalent to
def fn(....):
# body
fn = decorator(fn)
and... continue reading
Since dict now is ordered, how about a sort() method?
It could have the same signature of list.sort(), with an optional
parameter "by" that can be "keys" or "values" ("keys" could be the
default).
With CPython, tracebacks obtained from code written in C can be extremely
clean compared with functionally equivalent code written in Python.
Consider the following test file where I am using a local copy of Python's
datetime.py module.
from local_datetime import date
d = date(2021, 13, 1)
Executing this code results in the following, very "clean" traceback:
Traceback (most recent call last):
File "test.py", line 2, in <module>
d = date(2021, 13, 1)
ValueError: month mu... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/WQN7QJUVV62IO3J7ALOJYHS6URYVRDFD/)
The latest version of Grail is 0.6 which was released in 1999 was made for
Python 1 but I want to make one compatible with Python 3. But I need help
for that. Currently me and Guido van Rossum are working on this. Any help
will be welcomed. This is the link for the GitHub repo:
https://github.com/PrakharPythonProgrammer/Grail-0.6
Sincerely
Prakhar
I've recently released version 0.3.2 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.
The main changes in this release are as follows:
Fixed #139: improved handling of errors related to the test PyPI server.
Fixed #140: allowed "Obsoletes" in more scenarios, to better handle faulty
metadata already on PyPI.
Fixed #141: removed unused regular expression.
Fixed #143: re... continue reading
In Python ... is referred to as Ellipsis and cannot be assigned to.
Yet, one can assign any value to the name Ellipsis.
Consider the following:
>>> ...
Ellipsis
>>> ... == Ellipsis
True
>>> Ellipsis
Ellipsis
>>> Ellipsis = 3
>>> Ellipsis
3
>>> ... = 4
File "<stdin>", line 1
... = 4
^
SyntaxError: cannot assign to Ellipsis
>>> # But I just did assign a new value to the name Ellipsis above.
>>> Ellipsis
3
>>> ...
Ellipsis
>>> ... == Ellipsis
False
For consistency, `Elli... continue reading
Our program work group (WG) has been working hard over the last week to
select sessions for EuroPython 2021, based on your talk voting and our
diversity criteria.
We’re now happy to announce the initial list with more than 100
sessions, brought to you by more than 100 speakers.
* EuroPython 2021 Session List *
https://ep2021.europython.eu/events/sessions/
In the coming weeks, we will complete the session list, ad... continue reading
Hi all,
Last week, I started a new thread on discuss.python.org
https://discuss.python.org/t/farewell-for-now/8918?u=aeros about my
intention to take a further extended break from open source to continue my
mental health healing process. Just wanted to announce it in the other
channels as well since I know that not everyone has the bandwidth to keep
up with more than just the MLs.
In the thread, I discussed my intention to pursue the path of becoming a
Buddhist monk for some time, and recent... continue reading
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/
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 ... continue reading
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/
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
... continue reading
Functionalities are similar to Go channel but with topics or consumers like a message queue.
Possible syntax:
async def main():
ch = Channel()
await ch.put(1) # put
await ch.get() # get
await ch.close() # close
c1 = ch.consumer()
c2 = ch.consumer()
async for data in c1: # two consumer are indpendent
...
async for data in c2: ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/ZJOHPP4XNPLNMKPDB2COJ7XHNT755LOW/)
What is cx_Oracle?
cx_Oracle is a Python extension module that enables access to Oracle
Database for Python and conforms to the Python database API 2.0
specifications with a number of enhancements.
Where do I get it?
https://oracle.github.io/python-cx_Oracle
The easiest method to install/upgrade cx_Oracle is via pip as in
python -m pip install cx_Oracle --upgrade
What's new?
See the full release notes for all of the details:
https://cx-oracle.readthedocs.io/en/lates... continue reading
Python has support for conditional statement, list comprehensions, dict comprehensions, etc. So we can write these in mere one or two lines. But for try-except it's not possible to write it one or two lines. Many a times, we have one stmt that we want to check and if it raises error then do nothing or just execute one stmt. This idea proposes to add a way to write try-except for one stmt in one line.
Thanking you,
With Regards
From https://docs.python.org/3.10/whatsnew/3.10.html:
def http_error(status):
match status:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case _:
return "Something's wrong with the Internet"
The wildcard idea looks just wrong and confusing. What if I want to use it
as a variable and match against it like _ = 504? This is how it should be
done:
def http_error(status... continue reading
Hi,
What do you think of promoting the pythoncapi_compat project that I'm
introducing below in the "C API: Porting to Python 3.10" section of
What's New In Python 3.10?
Should this project be moved under the GitHub psf organization to have
a more "future proof" URL?
I would like to promote this project to prepare C extensions
maintainers for the following incompatible C API change (Py_TYPE) that
I would like to push into Python 3.11:
https://github.com/python/cpython/pull/26493
(Py_REFCNT was... continue reading
I have a failing test case in 3.10.0b1 for code that uses changes to sys.path and attempts to load unpackaged modules by
changing directory and placing '.' into sys.path; the code works as expected in 2.7.18, 3.6-3.10.0a7.
I printed out related variables in the a7 and b1 runs and find that sys.path is identical (modulo version name changes)
and that os.getcwd() is as expected and that os.path.isfile('./%s.py' % modulename) is True.
In a7 exec('%s as m', NS) works, but in b1 I get ModuleNotFo... continue reading
This is not a complete thought yet, but it occurred to me that while we
have deprecated APIs (which will eventually go away), and provisional APIs
(which must mature a little before they're declared stable), and stable
APIs (which everyone can rely on), it might be good to also have something
like unstable APIs, which will continually change without ever going away
or stabilizing. Examples would be the ast module (since the AST structure
changes every time the grammar changes) and anything to ... continue reading
Hi,
I have a crazy idea how to extend Python for web development.
What do you think? What are the next steps?
Original: https://github.com/guettli/python-custom-strings
Python Custom Strings
Python Custom Strings want to combine two great things:
Python Custom... continue reading
ACTIVITY SUMMARY (2021-05-28 - 2021-06-04)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7426 ( +2)
closed 48623 (+49)
total 56049 (+51)
Open issues with patches: 2940
#43921: test_ssl: test_wrong_cert_tls13() and test_pha_required_nocert
https://bugs.python.org/issue43921 reopened by christian.heimes
#4426... continue reading
Hi,
I have prepared a PEP proposing adding a stdlib function for defining
sentinel values. You can find the PEP here:
https://www.python.org/dev/peps/pep-0661/
The discussion is happening in the discourse server:
https://discuss.python.org/t/pep-661-sentinel-values/9126
To avoid splitting the discussion, please redirect your comments there
instead of replying to this thread.
Have a nice week,
As title. Is it faster for inplace sorting, or simply the
implementation of list.sort() was done before the implementation of
timsort?
Hi all,
It fills us with astronomical joy to announce the release of poliastro
0.15.0! 🚀
poliastro is an open source (MIT) pure Python library for interactive
Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed,
and quick visualization. It provides a simple and intuitive API, and
handles physical quantities with units. It is used in academia and the
industry by people from all around the world.
You can install it using pip or conda:
pip install poliastro
con... continue reading
Hi, folks,
Since Python 3.8, PyArg_Parse*() APIs and Py_BuildValue() APIs emitted
DeprecationWarning when
'#' format is used without PY_SSIZE_T_CLEAN defined.
In Python 3.10, they raise a RuntimeError, not a warning. Extension
modules can not use '#' format with int.
So how about making PY_SSIZE_T_CLEAN not mandatory in Python 3.11?
Extension modules can use '#' format with ssize_t, without
PY_SSIZE_T_CLEAN defined.
Or should we wait one more version?
Regards,
--
Inada Naoki <songofacandy... continue reading
Dear Python Developers,
I have found that default IDLE can't open .py files on double click and
IDLE isn't shown in "Open with" menu. I have solved this problem by
converting idle.bat in \lib\idlelibs\ into .exe file.
If you are interested in my help, you can learn more in my GitHub repo -
https://github.com/MatroCholo/idle2exe
Thanks for your extremely helpful attention to this matter.
Yours faithfully, MatroCholo
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.0rc2. The highlights are
PCG64DXSM bitgenerator for random numbers.This NumPy release is the result of 571 merged pull requests contribu... continue reading
Hello all,
I'm very happy to announce the release of pyo 1.0.4, available for python
3.6,
3.7, 3.8 and 3.9.
Pyo is a Python module written in C to help real-time digital signal
processing
script creation. It provides a complete set of classes to build audio
softwares,
compose algorithmic musics or simply explore audio processing.It is
available for
Windows, macOS and linux. It is released under the LGPL 3 license.
Official website: http://ajaxsoundstudio.com/software/pyo/
pyo... continue reading
Thank you Guido, Chris, Matt and Richard for your feedback to my last email.
Here is an updated version called "Template Literals".
I am looking for a core developer who can sponsor this PEP.
Please speak up if you want to help me.
Regards,
Thomas Güttler
Source and updates: Pre-PEP 9999
https://github.com/guettli/peps/blob/master/pep-9999.rst
PEP: 9999
Title: Template Literals
Author: Thomas Güttler <info at thomas-guettler.de>
Sponsor: TODO
Status: Draft
Type: Standards Track
Content... continue reading
Dear Python developers,
It would be helpful, if the following issue with copy-pasting python
code-snippets into the standard shell console, could be investigated and
corrected.
https://stackoverflow.com/questions/2501208/copying-and-pasting-code-into-the-python-interpreter
In particular, copying and pasting from sphinx python and pycon
code-blocks with copy button (only >>> and ... lines), is at present not
generally working due to the "the shell-s de-indent cmd" need for empty... continue reading
ACTIVITY SUMMARY (2021-06-04 - 2021-06-11)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7457 (+31)
closed 48676 (+53)
total 56133 (+84)
Open issues with patches: 2955
#11105: Compiling recursive Python ASTs crash the interpreter
https://bugs.python.org/issue11105 reopened by BTaskaya
#44242: enum.IntFlag r... continue reading
Hello all,
I recently opened a feature request for pytest (https://github.com/pytest-dev/pytest/issues/8768) to find out if a warnings filter capture anything.
Basic use-case: In big project with a lot of dependencies, the warnings filter list can grow a lot. Currently the only safe way to find out if a filter is still needed, is to remove it and then to run your code.
Therefore it would be nice to have a more automatic approach.
Suggestion for the warnings module: A new method wich returns a... continue reading
Sometimes it would be useful to be able to write:
def foo():
try: return thing()
except ValueError;
try: return otherthing()
except ValueError;
try: return yetotherthing()
except ValueError;
if shouldraise(): raise
But currently this needs to be written like so:
def foo():
try: return thing()
except ValueError:
try: return otherthing()
except ValueError:
try: return yetotherthing()
except ValueError:
if shouldraise(): raise
... continue reading
Hi all, I came across the following performance issue with the sum function
while summing lists: https://bugs.python.org/issue18305 It's been discussed
previously in this list and other issues.
The rationale in that ticket makes the case that performance won't be fixed
because sum() should not be treated as a generic way to concatenate
sequences (and there is documentation saying this).
Having non-linear complexity is not a suitable way to discourage this
behaviour though. Non-linearity is har... continue reading
After two weeks of hard work by our program workgroup, we are very
excited to announce the EuroPython 2021 schedule:
* EuroPython 2021 Schedule *
https://ep2021.europython.eu/schedule/
EuroPython 2021 will be held online in the week of July 26:
Summer is almost here (at least in half of the planet) and Python 3.10 is
finishing baking in the oven. For those of you that want to taste it before
is finally ready (and if you are a library developer, you certainly do!)
you can have the second-to-last beta now, but be careful as is still very
hot ;)
https://www.python.org/downloads/release/python-3100b3/
#This is a beta preview of Python 3.10
Python 3.10 is still in development. 3.10.0b3 is the third of four planned
beta release p... continue reading
Summer is almost here (at least in half of the planet) and Python 3.10 is
finishing baking in the oven. For those of you that want to taste it before
is finally ready (and if you are a library developer, you certainly do!)
you can have the second-to-last beta now, but be careful as is still very
hot ;)
https://www.python.org/downloads/release/python-3100b3/
#This is a beta preview of Python 3.10
Python 3.10 is still in development. 3.10.0b3 is the third of four planned
beta release previews. B... continue reading
ACTIVITY SUMMARY (2021-06-11 - 2021-06-18)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7446 (-11)
closed 48743 (+67)
total 56189 (+56)
Open issues with patches: 2962
#41611: IDLE: problems with completions on Mac
https://bugs.python.org/issue41611 reopened by terry.reedy
#43475: Worst-case behaviour of ha... continue reading
Python raises TypeError when NotImplemented is returned from add, invert etc. and radd etc. aren't available.
However, this disallows the customization of error messages. For example, in Python 3.8, float etc. were removed from complex to allow methods like rfloat. But this makes abs(z) undiscoverable for many users. The original error message is very helpful.
I suggest to make a way for this usage. Maybe NotImplementedType can accept *args, and NotImplemented can be callable... continue reading
After working with Kotlin for a while I really started to like the idea of extension methods. I delivers a great way to extend the language without having to add features to the language itself.
As a practical example I would like to take a first item from a list
my_list = []
first = my_list[0] # This will obviously throw an error
In this case it would be great to create an extension method like
def list.first_or_none(self):
if len(self):
return self[0]
return None
Or ...
... continue reading
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.7.0.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at:
https://github.com/scipy/scipy/releases/tag/v1.7.0
One of a few ways to install this release with pip:
pip install scipy==1.7.0
SciPy 1.7.0 is the culmination of 6 months of hard work. It contains
many new features, numero... continue reading
With normal synchronous code you can use contextvars.Context.run() to change what context code is executing within. However, there is no analagous concept for asyncio code. I'm proposing something similar, for example:
coro = foo()
my_context = convextvars.Context()
await asyncio.run_in_context(coro)
Currently the workaround is to run the coroutine on a separate task.
coro = foo()
my_context = convextvars.Context()
await my_context.run(asycnio.create_task, coro)
However this is not exactll... continue reading
As you might know, PEP 581 (Using GitHub Issues for CPython) has been
approved. I've been working with Ewa, Ee, the Working Group, the
Steering Council, and the GitHub folks to make this happen, and the SC
encouraged me to give you all a quick update.
This effort is being tracked at
https://github.com/psf/gh-migration/projects/1: this board reflects
the current status of the project. The PEPs (including PEP 588 --
GitHub Issues Migration Plan) haven't been updated yet and might
contain outd... continue reading
Hi everyone,
The SC has just published the community update for April:
https://github.com/python/steering-council/blob/main/updates
/2021-04-steering-council-update.md
As a reminder, we'll are trying to keep this up monthly. As you can see we
are mainly focusing on clearing the PEP backlog and addressing ongoing
efforts and time-sensitive issues. We have currently a very packed
agenda and we are doing our best to get to it as fast as we can,
prioritizing what's necessary (as bootstrapping t... continue reading
Hello,
Call for In-kind Sponsors is now open for PyCon India 2021[0]
Organizations with an interest in contributing and adding value to the
event and Python community can come forward to make the most out of
this opportunity.
What are In-kind Sponsors?
In-kind sponsorship is a type of sponsorship where the sponsor agrees
to provide swags (either physical or virtual, value-in-kind) instead
of cash as part of the sponsorship agreement with PyCon India. These
swags or the benefits would be made ... continue reading
Off-topic
Someone on this list wrote:
Mu.
https://en.wikipedia.org/wiki/Mu_(negative)#"Unasking"_the_question
This is a koan, a device in Zen Buddhism used by a teacher to help the
student liberate themselves from being imprisoned by rational discursive
thought.
Here is another koan.
A Zen student told Ummon: "Brilliancy of Buddha illuminates the whole
universe."
Before he finished the phrase Ummon asked: "You are reciting another's
poem, are you not?"
"Yes," answered the student... continue reading
The asynchat [1] and asyncore [2] libraries have been deprecated since 3.6
in favor of asyncio [3]. In addition, smtpd [4], which depends on asynchat
and asyncore, is deprecated in favor of aiosmtpd [5].
The documentation for each of these libraries mentions that it is
deprecated and refers to the suggested replacement. However, they do not
yet emit DeprecationWarnings at import, so people may be using them without
being aware that they are no longer maintained (there are a few dozen open
iss... continue reading
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.0. The highlights are
PCG64DXSM bitgenerator for random numbers.This NumPy release is the result of 581 merged pull requests contributed... continue reading
TL;DR I am considering changing IntEnum and IntFlag's __str__ to be int.__str__
IntEnum and IntFlag are becoming more common in the stdlib. They currently show up in
to name just a few.
3.10 already has some changes to the str() and repr() of enums in general:
HTTPStatus -> OK and HTTPStatus.OK instead of HTTPStatus.OK and <HTTPStatus.OK: 200>
Enum's that are taking the place of global constants have the repr() further modified:
RegexFlag -> ... continue reading
In a recent discussion with a colleague we wondered if it would be possible to postpone the evaluation of an f-string so we could use it like a regular string and .format() or ‘%’.
I found https://stackoverflow.com/questions/42497625/how-to-postpone-defer-the-evaluation-of-f-strings and tweaked it a bit to:
import inspect
class DelayedFString(str):
def str(self):
vars = inspect.currentframe().f_back.f_globals.copy()
vars.update(inspect.currentframe().f_back.f_locals)
... continue reading
I was debugging some code that was using TLSv1.2 when I expected it to only support TLSv1.3, I tracked it down to a call to:
context.miunimum_version = ssl.TLSVersion.TLSv1_3
it should have been:
context.minimum_version = ssl.TLSVersion.TLSv1_3
I'd like invalid attribute assignment to be prevented at runtime
In 2019, we have set up the Guido van Rossum Core Developer Grant, to
make it easy for Python Core Developers to attend EuroPython, but also
to give something back to the core team and add a perk to make core
development more attractive.
If you are a core developer, please check our grant page for details on
how to apply:
https://www.europython-society.org/core-grant
PS: If you are a core developer and want to organize a core sprint,
workshop, language summit or similar event at EuroPytho... continue reading
ACTIVITY SUMMARY (2021-06-18 - 2021-06-25)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7410 (-36)
closed 48834 (+91)
total 56244 (+55)
Open issues with patches: 2951
#34389: CPython may fail to build in the presence of a ~/.pydistutils.
https://bugs.python.org/issue34389 reopened by iritkatriel
#43988: Ad... continue reading
I am happy to announce the second release candidate for NetworkX
2.6! This release has a larger than normal number of changes in
preparation for the upcoming 3.0 release. The current plan is to
release 2.6 soon, 2.7 near the end of summer, and 3.0 near the end of
the year.
The focus of the 3.0 release is on addressing years of technical debt
and making it easier to contribute. The 2.6 release deprecates over
30 functions. It also makes major changes to our default
dependencies. We no l... continue reading
Hello list, it's my first email here, so let me know if this is in any way out of order.
I've been working a lot with concurrent.futures lately. I find both wait and as_completed very useful, but something I'm usually lacking is a wait version where the order of the futures is preserved. I quickly hacked a proof of concept to discuss with you and see if anybody else would find it useful: https://gist.github.com/santiagobasulto/10b689ba5fcadf307ffc5cd4f4ae00ec
I also realized that the imp... continue reading
Hi guys,
I want to have a version of concurrent.futures.ProcessPoolExecutor in
which every worker process shuts down after each task. I want this because
I believe I have a memory leak in my program that I wasn't able to fix.
(Possibly it's in C extensions that I use.)
Since I'm going to use a process pool anyway, I'm hoping to sidestep this
memory leak by launching every task on a worker process that shuts down
after it's done.
A few years back when I was working at Dell, they did somethin... continue reading
I was recently using the cmd module for a project where my CLI
could connect to and interact with another host. I implemented prompt in
such a way that it would show the IP address when connected. I.e.,
class MyCmd(cmd.Cmd):
...
@property
def prompt(self) -> str:
if self.remote_host.connected():
return f'> ({self.remote_host.ip}) '
else:
return '> '
This worked perfectly fine... until I ran mypy. mypy complained because,
in cmd.Cmd, promp... continue reading
This is a response in part to Thomas Güttler's "Pre PEP: Python Literals"
but I am starting a separate thread because I think it deserves separate
discussion, and it's not a direct response to that proposal.
Here's the problem: we want to allow escaping in strings to prevent
injection in HTML, SQL, etc.
Proposed solutions generally concentrate on a new kind of escaped format
string. I won't go into detail on why I don't like these ideas because
others have already covered that ground.
Instead... continue reading
[this is a continuation of https://bugs.python.org/issue44452]
pathlib.Path() has a concatenation operator "/" that allows the
right-hand-side argument to be an absolute path, which causes the
left-hand-side argument to be ignored:
pathlib.Path('/foo') / '/bar'
PosixPath('/bar')
pathlib.Path('/var/tmp/instroot') / '/some/path' / '/suffix'
PosixPath('/suffix')
This follows the precedent set by os.path.join(), and probably makes
sense in the scenario of simulating a user typ... continue reading
I am pleased to announce the availability of beta release 0.7.0 of
the "plum-py" package.
This pure Python package provides classes and utility functions to
transform byte sequences into Python objects and back. While similar
in purpose to Python's standard library struct module, this
package provides a larger set of format specifiers and is extensible,
allowing you to easily create complex ones of your own.
Docs: https://plum-py.readthedocs.io/en/latest/index.html
PyPi: https://... continue reading
I have spoken with Pablo (3.10 RM), and he agrees that a change to Enum str() in 3.10 and another in 3.11 is less than
ideal, so this new thread is to collect comments about Enum and it's str() and repr() and whether the changes take
effect in 3.10, 3.11, or both.
TL;DR -- sorry, there isn't one.
As Enum and IntEnum have started proliferating in the stdlib, some of those enumerations have changed the str() and
repr() of their members -- for example, in 3.8 re.RegexFlag had... continue reading
Python 3.9.6
Get it here: https://www.python.org/downloads/release/python-396/ https://www.python.org/downloads/release/python-396/
Python 3.9.6 is the newest major stable release of the Python programming language, and it contains many new features and optimizations. There’s been 146 commits since 3.9.5 which is a similar amount compared to 3.8 at the same stage of the release cycle. See the change log https://docs.python.org/release/3.9.6/whatsnew/changelog.html for details.
On macOS, we... continue reading
Python 3.9.6
Get it here: https://www.python.org/downloads/release/python-396/ https://www.python.org/downloads/release/python-396/
Python 3.9.6 is the newest major stable release of the Python programming language, and it contains many new features and optimizations. There’s been 146 commits since 3.9.5 which is a similar amount compared to 3.8 at the same stage of the release cycle. See the change log https://docs.python.org/release/3.9.6/whatsnew/changelog.html for details.
On macOS, we... continue reading
I’m happy to announce that PEP 657 (Include Fine Grained Error Locations in Tracebacks) has been unanimously accepted for Python 3.11 by the Python Steering Council.
Congratulations Pablo, Batuhan, and Ammar!
Cheers,
-Barry (on behalf of the Steering Council)
This is more of a syntactic sugar than an actual new feature, but...
Exactly, 'but' is the idea: a special keyword to be used in for statements to exclude values from the iterable.
E.g., when iterating over a generator:
for i in range(0, 10) but (2, 8):
would implicitly create a new generator comprehensively, as in:
for i in (j for j in range(0, 10) if j not in [2, 8]):
It might not add such a feature to justify the definition of a but_stmt in python.gram, but it's fully comp... continue reading
EuroPython 2021 offers special discounts on business tickets for company
teams.
* EuroPython Volume Discounts *
https://ep2021.europython.eu/sponsor/packages/#Volume-Discount
If you are going to attend the conference as a team, we offer the
following volume discounts as a thank you:
In addition to the above offer, we'll also send out a mentio... continue reading
Hi,
I was expected the announcement of a BDFL delegate for PEP 657, as the
author is a steering council member.
It seems that a PEP submitted by a SC member has been accepted by the SC
with seemingly no external review.
PEP 657 is likely to cause significant worsening of start up time and
interact poorly with debugging and profiling.
Cheers,
Mark.
I just stumbled upon the following issue and subsequent pull request. It is a very small bugfix. There is currently a bug in Python and this pull request fixes it. It's not a new feature or an enhancement, it is a bugfix! Yet, it doesn't get reviewed, nor merged. And this has been going on since March 2017. Why not just merge this? It's not like it's huge or obstructing or obfuscating the current code base? There's always time to write an improvement or a complete rewrite of this module feature ... continue reading
I am pleased to announce the release of SfePy 2021.2.
SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.
Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy
... continue reading
I am happy to announce Guppy 3 3.1.1
Guppy 3 is a library and programming environment for Python,
currently providing in particular the Heapy subsystem, which supports
object and heap memory sizing, profiling and debugging. It also
includes a prototypical specification language, the Guppy
Specification Language (GSL), which can be used to formally specify
aspects of Python programs and generate tests and documentation from a
common source.
Guppy 3 is a fork of Guppy-PE, created by Sverker Nils... continue reading
Hi,
Apologies for my tardiness in doing this, but no one explicitly said it
was too late to critique PEP 657...
First of all I want to say that I support the goal of improving error
messages. IMO the PEP should be "accepted in principle". I think all of
the issues below can be fixed while still supporting the general aims of
the PEP.
The chan... continue reading
Hi all,
VisPy 0.7.0 has just been released on PyPI and conda-forge. This is a
big release that has been in the works for a while now. This release was
made possible thanks to the Chan Zuckerberg Initiative's Essential Open
Source Software for Science Grant. I also want to thank the folks in the
Napari community (https://napari.org/) for helping us with new features,
bug fixes, and testing. We've also had a lot of help from the original
creators of VisPy including Almar Klein who has done ... continue reading
Hello Everyone,
We are happy to announce Luciano Ramalho as our next Keynote speaker for
PyCon India 2021.
Luciano Ramalho is the author of Fluent Python (O'Reilly), published
in 9 languages. He's been a professional Python programmer since 1998,
and he just finished writing the Fluent Python, Second Edition,
covering Python 3.9 and 3.10—to be released in Q4, 2021. Ramalho is a
Principal Consultant at ThoughtWorks, and co-founder of Garoa.net.br,
a hackersp... continue reading
Hi all,
I've created a pull request some time ago to fix
https://bugs.python.org/issue42044 (
https://github.com/python/cpython/pull/26678).
I know python devs are pretty busy, but I'd really appreciate it if someone
could take a look at it (as I think it's a simple fix).
Thanks,
Fabio
Hello,
I have a small suggestion to make about the generation of the
__pycache__ directory. Would it be possible to also generate a
CACHEDIR.TAG file in this directory when running Python on Linux? The
file is (informally?) specified at https://bford.info/cachedir/. This
would allow __pycache__ to be automatically excluded by various Linux
tools such as tar (using the --exclude-caches-all flag).
Cheers,
Leon
ACTIVITY SUMMARY (2021-06-25 - 2021-07-02)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7398 (-12)
closed 48891 (+57)
total 56289 (+45)
Open issues with patches: 2951
#23041: csv needs more quoting rules
https://bugs.python.org/issue23041 reopened by skip.montanaro
#41180: marshal load bypass code.new ... continue reading
I am delighted to announce the release 3.0.0 of Austin. If you haven't heard of Austin before, it is an open-source frame stack sampler for CPython, distributed under the GPLv3 license. It can be used to obtain statistical profiling data out of a running Python application without a single line of instrumentation. This means that you can start profiling a Python application straight away, even while it's running in a production environment, with minimal impact on performance.
The best way to le... continue reading
Have you ever wanted to build an image search system, take a deep dive
into pytest or learn about algorithmic trading? Then we have a treat for
you!
The EuroPython conference will start with two full training and workshop
days on Monday, July 26th, and Tuesday, July 27th:
* EuroPython Trainings and Workshops *
https://ep2021.europython.eu/events/trainings/
We have carefully curated 14 pa... continue reading
Hello, a few months ago i created this PR:
https://github.com/python/cpython/pull/24181
Which has since gone stale, I would really like it to be reviewed before i
continue fixing other issues as i do not want to have to deal with a
backlog of PRs
Thanks in advance, Yair.
I'm a lurker on this list and wanted to submit my own idea. It's a feature
I've been wanting in Python for a while, and I have a simple implementation
for it for personal use at the moment. Wanted to get feedback before I move
forward.
Essentially, I want to be able to perform a simple default get on a list if
an index does not exist, similar to a dictionary. For example:
my_dict = {"test1": "value1"}
my_dict.get("test2", None)
results in a "None" value, since the key doesn't exist.
Simi... continue reading
Hi,
Does anyone use threading debug PYTHONTHREADDEBUG=1 env var on a
Python debug build? If not, can I just remove it?
--
To fix a race condition at thread exit on Linux using the glibc, I
removed calls to pthread_exit() (PyThread_exit_thread()) in the
_thread module:
https://bugs.python.org/issue44434
A side effect of this change is the removal of the
"PyThread_exit_thread called" threading debug log when using
PYTHONTHREADDEBUG=1 environment variable.
I never used PYTHONTHREADDEBUG. I... continue reading
We’re very happy to announce our merchandise shop for EuroPython 2021,
with a fabulous new design for the attendee t-shirts:
* EuroPython 2021 Merch Shop *
https://ep2021.europython.eu/europython/europython-merchandise-shop/
You can find the shop under the "EuroPython" menu entry on the
conference website. It is run on the Spreadshirt platform and so
Spreadshirt will handle all payments, invoicing and shipping.
We have preconfigured a large number of items in the ... continue reading
I am happy to announce NetworkX 2.6.1 (2.6.0 had a minor issue)! This
release has a larger than normal number of changes in preparation for
the upcoming 3.0 release. The current plan is to release 2.7 near the
end of summer and 3.0 in late 2021.
The focus of the 3.0 release is on addressing years of technical debt
and making it easier to contribute. The 2.6 release deprecates over
30 functions. It also makes major changes to our default
dependencies. We no longer depend on the "decorator" ... continue reading
It's been brought up a few times eg: https://github.com/python/cpython/pull/12465
but I really think it's time to be re-considered.
Specifically I love being able to use asyncio.to_thread(pathlib.Path(...).read_text, encoding="utf8") It does exactly the right thing for me! It's great because it interacts with the event loop as few times as possible and uses only the RAM absolutely required.
I'm looking to be able to do something like asyncio.to_thread(pathlib.Path(...).json)
defined a... continue reading
ACTIVITY SUMMARY (2021-07-02 - 2021-07-09)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7397 ( -1)
closed 48931 (+40)
total 56328 (+39)
Open issues with patches: 2952
#38291: Deprecate the typing.io and typing.re pseudo-modules
https://bugs.python.org/issue38291 reopened by gvanrossum
#44550: Spam
https://... continue reading
Greetings!
A question [1] has arisen about the viability of random.SystemRandom in Pythons before and after the secrets module
was introduced (3.5 I think) -- specifically
does it give independent and uniform discrete distribution for
cryptographic purposes across CPython 3.x versions?
Any help appreciated!
--
~Ethan~
Wow! A release on a Saturday? Do the release management team even rest? You
better believe it, because this is the last of the planned beta releases.
This means that the next pre-release will be the first release candidate of
Python 3.10.0. Remember that our goal is to have no ABI changes after this
beta and a few code changes as possible after 3.10.0rc1.
https://www.python.org/downloads/release/python-3100b4/
#This is a beta preview of Python 3.10
Python 3.10 is still in developmen... continue reading
Wow! A release on a Saturday? Do the release management team even rest? You
better believe it, because this is the last of the planned beta releases.
This means that the next pre-release will be the first release candidate of
Python 3.10.0. Remember that our goal is to have no ABI changes after this
beta and a few code changes as possible after 3.10.0rc1.
https://www.python.org/downloads/release/python-3100b4/
#This is a beta preview of Python 3.10
Python 3.10 is still in development. 3.10.0b... continue reading
Hi there all,
I am preparing a team to start translating python documentation to Bengali.
I'd appreciate some reference materials, comments and ideas about this.
Thank you
This is a second call for talk proposals for PyConZA 2021. While we've
already received several great talk proposals, we still have a number
of open talk slots and are thus keen to see further talk submissions.
PyCon ZA 2021 will take place on the 7th & 8th of October, 2021. This
year, due to the ongoing pandemic, PyCon ZA will again be an online
event. We will be streaming the talks and using discord for discussion
around the talks and other conference activities.
We are looking for the follo... continue reading
This document describes the development and release schedule for
Python 3.11. The schedule primarily concerns itself with PEP-sized
items.
Hi python-ideas,
The subject is by no means new nor unique, and in fact has been discussed
on python-ideas at least once
https://mail.python.org/archives/list/python-ideas@python.org/thread/OPY3E4VFGV6KDALYS3YYKIYBNY363WGA/#HBOGGZT2ETWFYX2UN67D52554I2N6UP
before as well as in python/mypy#2403
https://github.com/python/mypy/issues/2403..
However, to date, there seems to be no standard way of deprecating things
declaratively, and ~every major library has its own internal API for that.
For ex... continue reading
Hello Everybody:
I'm proud to release version 2.1.0 of the Roundup issue tracker.
This 20th anniversary edition has been possible due to the help of
several contributors. This release is a bugfix and minor feature
release, so make sure to read
https://www.roundup-tracker.org/docs/upgrading.html to bring your
tracker up to date.
2.1.0 builds on the 2.0.0 major release that introduced:
Right now, writelines is a very big misnomer to many python developers, especially beginners who would expect writelines to put new lines at the end of every element in the list
My suggestion is to have either a writelines2 or a newline kwarg which does put new lines automatically at the end of every line written
currently lots of code manages contexts incorrectly by doing:
@dataclasses.dataclass
class WrapCmgr:
_cmgr: ContextManager[T]
def __enter__(self) -> Wrapped[T]:
return wrap(_cmgr.__enter__())
def __exit__(self, \, t: Type[BaseException] | None, v: BaseException, tb: types.TracebackType) -> bool:
return _cmgr.__exit__(t, v, tb)
since https://bugs.python.org/issue44471 using with WrapCmgr(cmgr()): incorrectly raises an AttributeError rather than a TypeErr... continue reading
Hi folks,
I just shipped a new release of Pythran—a compiler for scientific kernels written
in python.
It means it is available on PyPI and github, but not yet on conda, fedora, gentoo etc.
This one fixes a bunch of issues for Scipy (again), restores compatibility with
Cython, but the biggest change is definitively the new dependency tree.
Indeed, Pythran no longer depends on networkx, six nor decorator. The dependency
on gast and beniget received a version bump for compatibility ... continue reading
Hi. I have an Alpha/OSF machine up and running.
It is little slow, but it works ok.
I would like to run Python3 on it.
I have it "compiling and working". It was easy enough so far.
https://github.com/python/cpython/pull/27063
Admitted, I haven't figured out what is happening with the posixsubprocess module.
Yes? No? Maybe?
I can possibly provide ongoing "support" (I don't expect it will be much) and a buildbot (if really required),
if I can get it working a bit more, if this is approved, ... continue reading
Hey dear community,
I want to use advanced RGB Coloring in python for teminals.
There are already some modules but not advancrd enough.
I hope this feature will be added in the next python versions! ❤
I believe in this strong community, this will powerup our ascii designs in terminals most users made!
Hello Python Devs,
In accordance to PEP 0, I am looking for a Python-core-developer to sponsor
my new PEP. It is essentially a revisit of PEP 501. https://
github.com/nhumrich/peps/blob/master/pep-9999.rst
https://t.co/cCrqfWztAW?amp=1
Please let me know if you have questions, or would be interested in
sponsoring this PEP.
Nick Humrich
Hi there,
I've noticed that, when a frame's builtins is a subclass of dict with an overridden getitem method, this overriden method is not used by the IMPORT_NAME instruction to lookup import in the dictionary; it uses the lookup function of normal dictionaries (via _PyDict_GetItemIdWithError). This is contrary to the behaviour of the similar LOAD_BUILD_CLASS, as well as the typical name lookup semantics of LOAD_GLOBAL/LOAD_NAME, which all use PyDict_CheckExact for a "fast path" bef... continue reading
The EuroPython Society (EPS) exists not only to run the EuroPython
Conference, but also to support the wider Python community in Europe. It
accomplishes this in many ways; here are two of them!
* EuroPython Society supporting the community *
https://blog.europython.eu/europython-2021-conference-organizers-community-discounts/
We have an open invitation for organisers responsible for other Python
conferences around Europe to attend lunch with... continue reading
ACTIVITY SUMMARY (2021-07-09 - 2021-07-16)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7403 ( +6)
closed 48987 (+56)
total 56390 (+62)
Open issues with patches: 2951
#29753: [Linux] ctypes packs bitfields Incorrectly
https://bugs.python.org/issue29753 reopened by FFY00
#44184: crash on windows invoking fl... continue reading
Hi folks,
It's been a long time coming, but I've finally made enough progress on
the reference implementation that I think it's time to ask Nathaniel
to pronounce on the current iteration of PEP 558 (Defined semantics
for locals()).
The rendered version is up at
https://www.python.org/dev/peps/pep-0558/, and I've included the plain
text version below.
For those that are reading the PEP for the first time, the gist is:
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.1. The NumPy 1.21.1 is a maintenance release that fixes bugs
discovered after the 1.21.0 release. OpenBLAS has also been updated to
v0.3.17 to deal with arm64 problems.
The Python versions supported for this release are 3.7-3.9. The 1.21.x
series is compatible with development Python 3.10 and Python 3.10 will be
officially supported after it is released. Wheels can be downloaded from
PyPI <https:/... continue reading
EuroPython 2021 begins next week. We are proud to present the keynote
speakers and our conference booklet.
The following keynotes will take place on Wednesday, Thursday and
Friday. Tickets are still available.
If you want to find out more about our keynote speakers, please head on
to the keynotes page on our website.
https://ep2021.europython.eu/events/keynotes/
In this talk I will go into some interestin... continue reading
Introducing NestedText 3.0, a nice alternative to JSON, YAML, TOML
NestedText is a new file format for holding data that is to be entered, edited,
or viewed by people. It allows data to be organized into a nested collection of
dictionaries, lists, and strings without the need for quoting or escaping. In
this way it is similar to JSON and YAML, but without the complexity and risk of
YAML and without the syntactic clutter of JSON. NestedText is both simple and
natural. Only a small number o... continue reading
Proposal:
Have a weakref.link (not at all attached to the naming) primitive that allows one to keep object A alive while object B is alive. This would be functionally similar to adding A as an attribute of B from the GC's perspective without making any assumptions about what attributes are available in B. Here's a really course example of how this might be used:
This year's edition of EuroPython begins with two days of training
sessions as outlined in the schedule. Many of these last 3 hours,
however, we would like to highlight two specific workshops available to
those who want a deeper dive. They are most valuable for people new to
the Python language and ecosystem, and focus on different things.
Returning for another year, Django Girls will be running a workshop that
will teach you how to build your own blog from scratch over the course
of the day. Attendees will be split into small groups, and there are no
special requirements!
The Django Girls Workshop is scheduled on Monday, July 26th, starting at
09:30 CEST (07:30 UTC). Registration for this workshop is handled via
application on their website, which details the criteria they look for
in applicants.
https://djangogirls.org/nottingham/apply/
Read on to learn more about the workshop and Django Girls.
https://ep2021.europython.eu/ev... [continue reading](https://mail.python.org/archives/list/python-announce-list@python.org/thread/IINZNZTN7XQZ7OTWGM5XULSLVLG6ROD6/)
I see that the binascii module has several {a2b,b2a}_xyz functions for several flavors of ascii <-> binary conversions. But it misses a general base function set parameterized with a radix.
It would be nice to add a generic set of {a2b|b2a}(s, radix=r, case={'u','l'}), where radix is a power of 2 < 36 (2, 4, 8, 16 or 32) and case is only significant for b2a, to cover all trivial ascii <-> binary conversions using an efficient native implementation. Most {a2b,b2a}_xyz can just call the generic {a2b|b2a} with the appropriate radix.
'radix' could also be called 'base' for consistency with the int() functions.
I was actually surprised that it wasn't the case already...
PEP: 663
Title: Improving and Standardizing Enum str(), repr(), and format() behaviors
Version: $Revision$
Last-Modified: $Date$
Author: Ethan Furman ethan@stoneleaf.us
Discussions-To: python-dev@python.org
Status: Draft
Type: Informational
Content-Type: text/x-rst
Created: 23-Feb-2013
Python-Version: 3.11
Post-History: 20-Jul-2021
Resolution:
Now that we have a few years experience with Enum usage it is time to update
the repr(), str(), and format() of the various enumerations by their
intended purpose.
The addition of StrEnum with its requirement to have its str() be its
value is inconsistent with other provided Enum's str.
Having the str() of IntEnum and IntFlag not be the value causes
bugs and extra work when replacing existing constants.
Having the str() and format() of an enum member be different can be
confusing.
The iteration of Flag members, which directly affects their ``rep... continue reading
Hello Python-ideas,
I am working with lots of JSON objects in my work and need to obtain JSON
pointers to particular components of a JSON object. These pointers are
defined as part of the JSON-LD specifications as relative IRIs and as part
of the JSON-Schema specifications. However, I am not aware of these
pointers being part of the JSON specification. The pointers are really
straightforward and follow the same syntax as other IRIs (URLs) or file
paths. For example, the following flatten function illustrates the mapping
of nested dictionaries and arrays to a single flat dictionary, where each
nested key is mapped to a unique path.
d = {"a": 1, "b": {"ba": 2, "bb": [{"bba": 3, "bbb": None}]}}
flatten(d)
{'a': 1, 'b/ba': 2, 'b/bb/0/bba': 3, 'b/bb/0/bbb': None}
Not only does this conversion help in generating JSON pointers, but it
helps with logic for nested data structures. Specifically, assume there is
a dictionary, which includes nested dictionaries, lists, and tuples, and
any of... continue reading
Hi,
When I find what's new in 3.10 beta in
https://docs.python.org/whatsnew/3.10.html
It redirected me to https://docs.python.org/3/whatsnew/3.10.html which
shows 404 error not found nginx. Can you fix this?
Sincerely
xXPartOfMeXx
PEP: 663
Title: Improving and Standardizing Enum str(), repr(), and format() behaviors
Version: $Revision$
Last-Modified: $Date$
Author: Ethan Furman ethan@stoneleaf.us
Discussions-To: python-dev@python.org
Status: Draft
Type: Informational
Content-Type: text/x-rst
Created: 23-Feb-2013
Python-Version: 3.11
Post-History: 20-Jul-2021
Resolution:
Now that we have a few years experience with Enum usage it is time to update
the repr(), str(), and format() of the various enumerations by their
intended purpose.
The addition of StrEnum with its requirement to have its str() be its
value is inconsistent with other provided Enum's str.
Having the str() of IntEnum and IntFlag not be the value causes
bugs and extra work when replacing existing constants.
Having the str() and format() of an enum member be different can be
confusing.
The iteration of Flag members, which directly affects their ``rep... continue reading
It has become a tradition at EuroPython to include a special data
science track.
* EuroPython 2021 Data Science Mini-Conference *
https://ep2021.europython.eu/events/data-science/
This year, we have expanded on the theme and included more data science
related content than ever before, including keynotes and workshops --
our own EuroPython Data Science mini-conference which includes:
Tickets are still available through our online shop and will be
throughout next week.
https://ep2021.europython.eu/registration/buy-tickets/
We’ would like like to highlight our data science keynotes on Thursday:
Claudia Comito: Connecting Communities: the Helmholtz Analytics
Framework and the making of Heat
HPC, Scientific Big Data, co-design, Python: beneath the buzzwords,
bringing together academics from the most disparate research fields to
work on ... continue reading
ACTIVITY SUMMARY (2021-07-16 - 2021-07-23)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7420 (+17)
closed 49041 (+54)
total 56461 (+71)
Open issues with patches: 2951
#44656: Dangerous mismatch between MAXPATHLEN and MAX_PATH on Windows
https://bugs.python.org/issue44656 opened by izbyshev
#44657: instancemethod_call should use PyInstanceMethod_GET_FUNCTION m
https://bugs.python.org/issue44657 opened by colesbury
#44658: No ValueError for duplicate key value in mapping patern when l
https://bugs.python.org/issue44658 opened by jack__d
#44660: email.feedparser Module Lacks Support for Section 3.5 of RFC 6
https://bugs.python.org/issue44660 opened by f18a14c09s
#44662: Add ability to annotate types.Union
https://bugs.python.org/issue44662 opened by uriyyo
#44663: Possible bug in datetime ut... continue reading
In 3.10 the union type (the type of the result of the | operator for
types) was added (https://www.python.org/dev/peps/pep-0604/). It is
exposed as types.Union. There are differences between typing.Union and
types.Union:
types.Union corresponds to private class typing._UnionGenericAlias, not
typing.Union. It is confusing that typing.Union and types.Union have the
same name but are so different. Note also that most classes in the types
module have the "Type" suffix: FunctionType, MethodType, ModuleType,
etc. I think that it would be better to rename types.Union to
types.UnionType.
The name of types.Union is the part of already accepted PEP 604, so we
need to hear opinions of authors, sponsor and BDFL-delegate of the PEP.
I did not participate in the discussion about PEP 604 so I do not know
if there are arguments in favor of types.Union over types.UnionType.
Hi!
I'm interested in this workflow issue of cpython pull requests that get
tons of review and feedback, but, for whatever reason, ultimately lose the
attention of the original contributor. I opened a GitHub issue on the dev
guide repo where I wrote more about the problem, and proposed some
solutions/ideas. I'm hoping that the issue might get more attention if I
mentioned it here, too, so I'm wondering if you can take a moment to check
it out and continue the conversation on GitHub.
https://github.com/python/devguide/issues/731
Thanks!!
Jack
Hi,
First of all let me say that I agree with the aims of PEP 558 and most
of the design.
I do find the wording of the PEP itself a bit confusing in a couple of
places.
This critique is based on my understanding of the PEP.
If I am mistaken in my misunderstanding, then treat that as an implied
request for clarification of the PEP :)
[This is largely to help the reader, it doesn't change the nature of the
PEP]
Could we replace the section "CPython Implementation Changes" with a
section that states what the behavior will be, not how it changes.
Having to mentally apply the suggested changes to the existing (and
convoluted) implementation makes it hard to work out what the proposed
behavior will be.
Could the design discussion be moved to an appendix or another document?
The key parts of it should be moved to the Rationale or Motivation.
There should be a Motivation section explaining why this PEP ... continue reading
Wing 8 is a major new release that introduces support for development on
Docker and LXC/LXD containers and Docker Compose clusters, a Python
package management tool, improved project creation, improved static
analysis and code warnings, support for Python 3.10, a native Apple
Silicon (M1) build, a new Nord style theme, reduced application startup
time, and much more.
Details: https://wingware.com/news/2021-07-26
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes exte... continue reading
Hi everyone,
This is a friendly reminder from the release management team that the first
release candidate of Python 3.10 is
next Monday. Now is a fantastic time you make sure that:
Currently type hints for built-in containers are, in my opinion, less succint than required. I suspect it is probably not very difficult for a type checker to interpret something like this for example:
var1: {str: (int, int)} = {"label": (1, 2)}
var2: {str} = {"other_label"}
def function(param1: {int: str} = {1: "foo"}, param2: (int, ...) = (1, 2, 3)) -> (int, (str, ...)):
return 3, ("foo", "bar")
as equivalent to:
var1: dict[str, tuple[int, int]] = {"label": (1, 2)}
var2: set[str] = {"other_label"}
def function(param1: dict[int, str] = (1, "foo"), param2: tuple[int, ...] = (1, 2, 3)) -> tuple[int, tuple[str, ...]]:
return 3, ("foo", "bar")
I thought of posting something like this as a mypy feature suggestion, but I suspect the language would need to modify the way type annotations are interpreted for something like it to work (or maybe not?).
Basically, inside a type annotation, the objects created by (a, b), [a], {a: b}, {a} would be reinterpreted as the same thing as c... continue reading
您好,我想咨询阅读python语言参考手册时遇到的相关问题,
我在这个网址https://mail.python.org/archives/list/python-dev@python.org/thread/HQPEBKZRJPJHYRJ4TRLFZT5PNL6J3VTT/#ZK2EGC5ZTB52CIATH744RAPFLJWUUZU4
看到该邮箱地址,不知道是否可以用来咨询此类问题?或请推荐咨询的渠道。
《python语言参考手册》--数据模型章节--静态方法对象:
“避免函数对象转换为方法对象”是指在实例对象在获取属性时,避免类中定义的方法(即:函数对象)转换为实例方法么?
为什么在python中,会设置这种在类中将用户定义的函数封装起来从而防止其转换为实例方法,这种封装一般应用在哪些情况下呢?
Hello, I would like to consult related issues encountered when reading the python language reference manual,
I am at this URL https://mail.python.org/archives/list/python-dev@python.org/thread/HQPEBKZRJPJHYRJ4TRLFZT5PNL6J3VTT/#ZK2EGC5ZTB52CIATH744RAPFLJWUUZU4
Seeing the email address, I wonder if it can be used to consult such questions? Or please recommend a channel for consultation.
"Python Language Reference Manual"-Data Model Chapter-Static Method Object:
"Avoid converting function objects into method objects" refers to avoiding the methods defined in the class (ie: function objects) from being converted into instance methods ... continue reading
[Migrating the discussion from https://bugs.python.org/issue44768.]
PEP 20 says:
There should be one-- and preferably only one --obvious way to do it.
There are two ways to create a simple named type to store data: collections.namedtuple and dataclasses.dataclass. I propose deprecating namedtuple.
As far as the interface is concerned, the namedtuple is almost completely equivalent to a frozen dataclass - with some iterability syntactic sugar thrown in. I don't think there are use cases for namedtuple that would not be trivial to rewrite with dataclasses.
As far as the implementation is concerned, the namedtuple is faster. If efficiency is a concern, why do we make our users decide? We can choose the most efficient one on the library's end. C++ does something similar with bool vectors - the library has a special case for where it would be more optimal to use a different data structure underneath.
TL;DR: If dataclass is so good, why keep namedtuple around?
Hi everyone,
I would like to repeal PEP 509. We don't really have a process for
repealing a PEP. Presumably I would just write another PEP.
Before I do so, I would like to know if anyone thinks we should keep
PEP 509.
The dictionary version number is currently unused in CPython and just
wastes memory. I am not claiming that we will never need it, just that
we shouldn't be required to have it. It should be an internal
implementation detail that we can add or remove depending on requirements.
Thoughts?
Cheers,
Mark.
[Migrating from https://bugs.python.org/issue44701]
Would it be interesting to create a @deprecated decorator to avoid adding warnings.warn("deprecation message", DeprecationWarning, stacklevel=2) in methods body?
Using the decorator approach to indicate depreciation would make the methods cleaner (leaving only their responsibilities in the body) and would be easier to identify, as the cue would be close to the method signature and not mixed with the logic inside the body.
in some cases it will still be necessary to put warnings.warn (..) inside the body of functions/methods because of some message display condition, or we could also express the message display condition in the decorator in @deprecated itself. But it would be interesting to have the possibility of not putting this inside the method body. Even the decorator can come from the notices module.
Example:
(Before)
def check_metadata(self):
"""Deprecated API."""
warn("distutils.command.register.check_meta... continue reading
The documentation for PyTypeObject.tp_base (https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_base) says the following:
Note: Slot initialization is subject to the rules of initializing
globals. C99 requires the initializers to be “address constants”.
Function designators like PyType_GenericNew(), with implicit
conversion to a pointer, are valid C99 address constants.However, the unary ‘&’ operator applied to a non-static variable
like PyBaseObject_Type() is not required to produce an address
constant. Compilers may support this (gcc does), MSVC does not. Both
compilers are strictly standard conforming in this particular
behavior.
I think this may be incorrect. Specifically, it seems to be confusing "static variable" with "static storage duration."
It is true that C99 requires address constants to have static storage duration. The relevant text in C99 is 6.6p9:
An address constant is a null pointer, a pointer to an lvalue
desi... continue reading
Hi Nick,
Our discussion on PEP 558 got me thinking
"What is the simplest thing that would work?".
This is what I came up (in the form of a draft PEP):
https://github.com/markshannon/peps/blob/pep-locals/pep-06xx.rst
It doesn't have O(1) len(f_locals), and it does break
PyEval_GetLocals() but I think the that is a small price to pay for
simplicity and consistency.
What do you think?
Cheers,
Mark.
Hello Nick, Ethan,
The Python Steering Council reviewed PEP 467 -- Minor API improvements for binary sequences at our 2021-07-26 meeting.
Thank you for work on this PEP. We’re generally very favorable for adding to Python 3.11 the features and APIs described in the PEP. We have some requests for changes that we’d like you to consider.
The Python-Version in the PEP needs to target Python 3.11 of course.
We think it would be better if bytes.fromsize()’s second argument was a keyword-enabled or keyword-only argument. We understand the rationale given in the PEP for not doing so, but ultimately we think the readability of (at least allowing) a keyword argument to be more compelling. Some possible options include fill, value, or byte.
We all really dislike the word “ord” as in bytes.fromord(). We understand the symmetry of this choice, but we also feel like we have an opportunity to make it more understandable, so we recommend bytes.fromint() and `bytearray.fromin... continue reading
Jeremy informed mehttps://github.com/python/cpython/pull/27436#issuecomment-889815333 that due to a race condition on a test file and the CPython repo configuration for newline conversion, build bots on Windows may now be failing.
If you run such a buildbot, please consider running this command on your repo to bypass the issue:
git rm -r :/ ; git checkout HEAD -- :/
You may want to consider adding this command after every update to the repo to avoid the stale state.
ACTIVITY SUMMARY (2021-07-23 - 2021-07-30)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7395 (-25)
closed 49121 (+80)
total 56516 (+55)
Open issues with patches: 2926
#15870: PyType_FromSpec should take metaclass as an argument
https://bugs.python.org/issue15870 reopened by belopolsky
#36050: Why does http.client.HTTPResponse._safe_read use MAXAMOUNT
https://bugs.python.org/issue36050 reopened by bmerry
#41103: Removing old buffer support
https://bugs.python.org/issue41103 reopened by methane
#44479: Windows build doesn't regenerate some files
https://bugs.python.org/issue44479 reopened by steve.dower
#44676: Add ability to serialise types.Union
https://bugs.python.org/issue44676 reopened by serhiy.storchaka
#44729: sys.setprofile bug
https://bugs.python.org/issue44729 opened by AliyevH
... continue reading
https://bugs.python.org/issue42815
https://github.com/python/cpython/pull/24074
I would love to have this in Python 3.10, but the interaction with
"decimal" context has a risk I don't know how to evaluate, neither the
impact of a new "context" parameter when launching a new thread. It
could collide with a "frequently used" parameter name.
I know that we are quite late in 3.10 window since rc1 is planned in a
couple of days, but I think this enhancement is sensible. In fact, I
discovered it after being annoyed myself with this issue (threads should
have their own contexts) and studying the code to write a patch myself.
In particular, "concurrent.futures" threads should have independent
contexts, like asyncio futures have. That would allow, for instance, to
have a "requests.Session" object per thread since that object is not
thread-safe (my use case today) and reuse it in different futures that
happens to run in the same thread.
Since "contextvars" is "threading.local" co... continue reading
Hi all,
On behalf of the SciPy development team I'm pleased to announce
the release of SciPy 1.7.1, which is a bug fix release.
Sources and binary wheels can be found at:
https://pypi.org/project/scipy/
and at: https://github.com/scipy/scipy/releases/tag/v1.7.1
https://github.com/scipy/scipy/releases/tag/v1.6.3
https://github.com/scipy/scipy/releases/tag/v1.6.1
One of a few ways to install this release with pip:
pip install scipy==1.7.1
SciPy 1.7.1 is a bug-fix release with no new features
compared to 1.7.0.
A total of 9 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully
complete.
... continue reading
Hello Everyone,
The PyCon India 2021 workshop & talk schedule is out[0].
We thank everyone who submitted their proposals for talks, workshops,
Bird of Feathers (Bofs), and poster sessions being organized this
year.
The call for proposals is a critical aspect of the conference, and we
got over 150 submissions! The review committee, along with all the
volunteers,
worked quite hard to make the deadlines work.
All these efforts go on to accomplish one outcome. An incredible PyCon
India keeping you at its epicenter!
As we are releasing the workshop, talk, and keynotes schedule, be sure to look
out for the release of poster presentations, panel discussions, and
information about many more events in the coming days on Twitter and
on our mailing list.
Our Mentorship working group is working double-time to get all the
speakers on top
shape for making this year's PyCon India experience amazing for
everyone.
To check the schedule you can visit the schedule page[1].
Links:
[0]. https://in.py... continue reading
Python 3.10.0 is almost ready. This release, 3.10.0rc1, is the penultimate
release preview. You can get it here:
https://www.python.org/downloads/release/python-3100rc1/
This is the first release candidate of Python 3.10
This release, 3.10.0rc1, is the penultimate release preview. Entering
the release candidate phase, only reviewed code changes which are
clear bug fixes are allowed between this release candidate and the final
release. The second candidate and the last planned release preview is
currently planned for 2021-09-06 while the official release is planned for
2021-10-04.
There will be no ABI changes from this point forward in the 3.10 series and
the goal is that there will be as few code changes as possible.
Call to action
Core developers: all eyes on the docs now
Community members
We strongly encourage maintainers of third-party ... continue reading
Python 3.10.0 is almost ready. This release, 3.10.0rc1, is the penultimate
release preview. You can get it here:
https://www.python.org/downloads/release/python-3100rc1/
This is the first release candidate of Python 3.10
This release, 3.10.0rc1, is the penultimate release preview. Entering
the release candidate phase, only reviewed code changes which are
clear bug fixes are allowed between this release candidate and the final
release. The second candidate and the last planned release preview is
currently planned for 2021-09-06 while the official release is planned for
2021-10-04.
There will be no ABI changes from this point forward in the 3.10 series and
the goal is that there will be as few code changes as possible.
Call to action
Core developers: all eyes on the docs now
Community members
We strongly encourage m... continue reading
Hi,
A recent change "make html" in the Doc directory create a venv if one
wasn't there before. If you don't want to download sphinx and other
dependencies from PyPI, you'll need to adjust your workflow.
If you already have all the dependencies, the following command (in the
CPython directory, not Doc) will build docs for you:
sphinx-build Doc Doc/build/
The issue that added this is: https://bugs.python.org/issue44756
Hi,
After some effort, I just finished a new extensive document in the devguide
regarding how
to use the new PEG parser and the PEG grammar:
https://devguide.python.org/parser/
The document contains descriptions, backgrounds, references, guides, and
tips. Ideally,
this will make it a bit easier for everyone that wants to deal with the
grammar or the parser.
Hope that you find it useful :)
P.S. Thanks to everyone that helped with the review!
Regards from cloudy London,
Pablo Galindo Salgado
Following on from PEP 634, it would be good to be able to have Erlang /
Elixir-style pattern matching in function headers.
(I don't know what the technical term is for this language feature, but
hopefully the examples will clarify.)
Here's the obligatory fibonacci example:
def fib(0):
return 0
def fib(1):
return 1
def fib(n):
return fib(n-1) + fib(n-2)
Or, another example:
def allow_entry({"name": "Bob"}):
return "Bob is not allowed in ever!"
def allow_entry({"name": "Charles", "day": "Tuesday"}):
return "It's a Tuesday, so Charles is allowed in."
def allow_entry({"name": "Charles", "day": _}):
return "Charles is only allowed in on a Tuesday."
def allow_entry({"name": name}):
return f"Come in {name}, make yourself at home!"
Thanks for considering my idea.
Kind regards
Sam Frances
Before the introduction of bool and also in other languages, not not x was/is used to convert to True (1) and False (0). However, the old way is still much faster than bool(x) or even operator.truth(x).
Test:
py -3.10 -m timeit -s "objects = 1, 0, -0.0, "20", "False", 93, 28.569, [], set(), {1: 5}" "[(not not x) for x in objects]"
200000 loops, best of 5: 1.12 usec per loop
py -3.10 -m timeit -s "objects = 1, 0, -0.0, "20", "False", 93, 28.569, [], set(), {1: 5}" "[(bool(x)) for x in objects]"
200000 loops, best of 5: 2.32 usec per loop
py -3.10 -m timeit -s "from operator import truth; objects = 1, 0, -0.0, "20", "False", 93, 28.569, [], set(), {1: 5}" "[(truth(x)) for x in objects]"
200000 loops, best of 5: 2.04 usec per loop
py -3.10 -V
Python 3.10.0rc1
That's nearly 52%/46% faster! I guess the name lookup and the FUNCTION_CALL is slower than UNARY_NOT. So actually, using not not is an optimize, although it isn't clear. This is interesting.
OpenAPI (https://spec.openapis.org/oas/latest.html) is an emerging standard for defining RESTful interfaces.
OpenAPI is supported by swagger - which provides tools to convert an OpenAPI spec into python code (for both backend as well as client).
The proposition I have is to make OpenAPI native to python. Essentially, this involves some of the following:
The Native Python implementation would load in OpenAPI specification and provide native Python experience as follows:
ACTIVITY SUMMARY (2021-07-30 - 2021-08-06)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7397 ( +2)
closed 49189 (+68)
total 56586 (+70)
Open issues with patches: 2933
#34013: Inconsistent SyntaxError for print
https://bugs.python.org/issue34013 reopened by brandtbucher
#43853: [sqlite3] Improve sqlite3_value_text() error handling
https://bugs.python.org/issue43853 reopened by serhiy.storchaka
#44206: Add a version number to dict keys.
https://bugs.python.org/issue44206 reopened by pablogsal
#44524: name attribute in typing module
https://bugs.python.org/issue44524 reopened by kj
#44698: Undefined behaviour in Objects/complexobject.c's complex_pow
https://bugs.python.org/issue44698 reopened by mark.dickinson
#44756: In ./Doc, "make html" and "make build" should depend on "make
https:/... continue reading
This is a proposal to change the behaviour of the startswith() and
endswith() methods for str, bytes and bytearray objects, making them
return the matched value instead of the True boolean.
Here a str example with the endswith() method:
domain = "python.org"
if domain.endswith(".fr"):
print(".fr")
elif domain.endswith(".com"):
print(".com")
elif domain.endswith("org"):
print(".org")
With the ".org" non-empty str returned by the endswith() method
instead of the True boolean, the above code will work in the same
manner; moreover as startswith() and endswith() methods support a
tuple as argument, and as the PEP 572 walrus operator is supported
since Python 3.8, we can now write this code in a more compact and
pythonic way:
if suffix := domain.endswith((".fr", ".com", ".org"):
print(suffix)
As the PEP 616 new methods removeprefix() and removesuffix() don't
support a tuple as argument, it will provide a nice and pythonic way
to do it:
if suffix := domain.endswith((".f... continue reading
Hi. I would like to suggest to add functionality to argparse
For example we can have one ArgumentParser instance, for (windows, linux), (community edition, pro edition) apps. It could give ability to show and be able to run only allowed commands based on version of os, app or some other logic.
import argparse
def some_callable():
if edition() == 'pro_edition':
return True
return False
parser = argparse.ArgumentParser(
prog="CustomProgramm",
description="CustomProgramms custom description",
epilog='Epilog of this',
)
parser.add_argument('--full-function', target=some_callable)
This --full-function argument will be available only if some_callable function is True, otherwise it will not be shown in command line arguments.
I'd like to revive the discussion of PEP 649
[https://www.python.org/dev/peps/pep-0649/] that started shortly before
development of 3.10 features was closed. This is Larry's PEP to defer
evaluation of annotations until it's actually accessed. During the
discussion the decision was made to back out the change that made "from
future import annotations" (PEP 563
[https://www.python.org/dev/peps/pep-0563/]) the default behavior for 3.10.
My understanding is that PEP 649 is currently in front of the SC. But do
we need to have any additional discussion here? My recollection is that
we backed out the PEP 563 change because we didn't feel we had enough
time to come to a good decision one way or the other before 3.10.
Personally, I'd like to see PEP 649 accepted. There are a number of
issues on bpo where people expect dataclass's field.type to be an actual
Python object representing a type, and not a string. This field is
copied directly from annotations. If we stick w... continue reading
There have been a series of requests to enhance the current main.rst
document https://docs.python.org/3/library/__main__.html:
bpo-17359 https://bugs.python.org/issue17359
bpo-24632 https://bugs.python.org/issue24632
bpo-39452 https://bugs.python.org/issue39452
So, I rewrote it! I went ahead and hosted it on my website for you all to
easily take a look: https://jackdevries.com/pydoc__main__/library/__main__.html
Of course, you can go directly to the GitHub PR instead:
https://github.com/python/cpython/pull/26883
For reference, here is a link to the current document:
https://docs.python.org/3/library/__main__.html
This is a major change, so I'm thankful for anyone who can take the time to
review it. I am a new cpython contributor, so advice for how to push this ahead
is also welcome. For example, should I break this up into multiple PRs at this
point?
Thank you all!
Hi All,
There are now NumPy Python 3.10.0rc1 wheels available for 64 bit Linux on
Intel. You can install them from the nightly builds using "pip install -i
https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy". Test away.
Cheers,
Charles Harris
Not to specifically pick on Eric V. Smith, but yesterday a co-worker came
to me asking about KW_ONLY for dataclasses and wanting to provide
feedback (
https://docs.python.org/3.10/library/dataclasses.html#dataclasses.KW_ONLY).
I said we had reached RC and so it was pretty much too late; the alphas and
betas are when one should provide feedback.
But then I realized you wouldn't even know about this new feature unless
you read What's New ... and that's when I found out this new feature isn't
mentioned (yet). As of right now the only dataclass feature documented in
the What's New is something about slots (
https://docs.python.org/3.10/whatsnew/3.10.html#dataclasses).
So my question is whether we want to push to be more diligent about
updating What's New by b1 so people can provide feedback during the betas
beyond just reporting breaking changes?
Hi. I am working on a kinda-ORM library, which usage often implies to request data within specific ranges:
Foobar.search(
attr1="foo",
attr2=gt(10),
attr3=between(42, 50)
)
The use of "gt" or "between" methods to describe those operations feels a bit cumbersome (as it is long to write, and you need to import those functions in a lot of files), and I though it could be more pythonic to use slices instead.
Foobar.search(
attr1="foo",
attr2=slice(10),
attr3=slice(42, 50)
)
I suggest an alternative way to instanciate slices, that would look like this:
Foobar.search(
attr1="foo",
attr2=[10:],
attr3=[42:50]
)
What do you think?
Hi all,
As of 3.10 (PEP 604) we've gotten syntactical support for a common type
operation— namely, typing.Union[Type1, Type2] can now be written as Type1 |
Type2 . This is achieved via overriding the or method.
I propose the ? symbol as sugar for typing.Optional, so that
typing.Optional[MyType] can be written as MyType? . (Yes, this is lifted
directly from C#.)
Thoughts? Is it unnecessary now that we can write MyType | None as of 3.10?
Thanks,
Will
Hi All,
On behalf of the NumPy team I am pleased to announce the release of NumPy
1.21.2. NumPy 1.21.2 is a maintenance release that fixes bugs discovered
after 1.21.1. It also provides 64 bit manylinux Python 3.10.0rc1 wheels for
downstream testing. Note that Python 3.10 is not yet final. There is also
preliminary support for Windows on ARM64 builds, but there is no OpenBLAS
for that platform and no wheels are available.
The Python versions supported for this release are 3.7-3.9. The 1.21.2
release is compatible with Python 3.10.0rc1 and Python 3.10 will be
officially supported after it is released. The previous problems with
gcc-11.1 have been fixed by gcc-11.2, check your version if you are using
gcc-11. Wheels can be downloaded from PyPI
https://pypi.org/project/numpy/1.21.2/; source archives, release notes,
and wheel hashes are available on Github
https://github.com/numpy/numpy/releases/tag/v1.21.2. Linux users will
need pip >= 0.19.3 in order to install man... continue reading
Hi All!
We are trying to replace a link in the official docs which is now
broken, but used to link to this article:
Can you offer a suggestion for a replacement? The bad link has already
been removed. Also see the bpo:
https://bugs.python.org/issue44830
Also see the rather stale discourse post to the same effect as this
email (asking for replacement article ideas):
https://discuss.python.org/t/alternate-article-for-how-to-wite-good-bug-report/10040
Thanks!
Jack
https://mail.python.org/archives/list/python-dev@python.org/thread/JRFJ4QH7TR35HFRQWOYPPCGOYRFAXK24/
I can't be objective with Marco as I believe we have recorded issues with
him previously (as with Steven if you take Marco's initial side with this).
The thing that pushed me over the edge to report this was
https://mail.python.org/archives/list/python-dev@python.org/message/O3JB3FE33KMT3OHZCVH3XO6VNJTGH5NL/
.
Announcing the release of Blue version 0.7.0!
Some folks like black <https://black.readthedocs.io/en/stable/>_ but I
prefer blue <https://blue.readthedocs.io/en/latest/>_.
blue is a somewhat less uncompromising code formatter than black, the
OG of Python formatters. We love the idea of automatically formatting Python
code, for the same reasons that inspired black, however we take issue with
some of the decisions black makes. Kudos to black for pioneering code
formatting for Python, and for its excellent implementation.
Where the blue maintainers disagree with the stylistic (and
unconfigurable) choices made by black, we monkeypatch to change thes... continue reading
Hi Mario,
Thank you for submitting PEP 648 (Extensible customizations of the
interpreter at startup). The Steering Council has reviewed the PEP and
after careful consideration, we have decided to reject the PEP. There are a
number of reasons why we have arrived at this decision so we would like to
explain our view of the PEP.
After careful analysis of the PEP, it is clear to us that the main focus of
the PEP (as stated in the document) is to provide a more clear mechanism
for system administrators and tools that repackage the interpreter. The PEP
also mentions “some libraries” but we are not actually convinced of the
positive impact on the PEP in this regard (see below).
Our main concern is that the improvements proposed in this PEP have a very
limited set of use cases and doesn’t really act as a replacement for the
library usage of pth files but further complicates the startup sequence
with even more things to consider, including the interaction between this
mechanism with virtuale... continue reading
Greetings list,
As preparations for FlaskCon intensifies, the call for
volunteers goes live:
https://twitter.com/FlaskCon/status/1427542892642410502?s=20
You can also chip in directly here:
https://docs.google.com/forms/d/e/1FAIpQLSfsHNBcclWSmVkk4LDD_EnlhrlKdWlGOakdwbt5PbaFklpHAA/viewform
According to previsions, it might be the last Python conf of the year!
Kind Regards,
Abdur-Rahmaan Janhangeer
about https://compileralchemy.github.io/ | blog
https://www.pythonkitchen.com
github https://github.com/Abdur-RahmaanJ
Mauritius
The error mentioned in the title is this.
*()
File "<stdin>", line 1
SyntaxError: can't use starred expression here
According to the Language Reference
https://docs.python.org/3/reference/expressions.html#expression-lists
it's not really a starred expression. In the context of defining the
notion of starred expressiont, it looks like it's called a starred
item. I think the message is confusing and should be fixed. I don't
know if "starred item" is the right name to be used there, but it's
at least documented (in the Reference).
Best regards,
Takuo
Hello,
before posting to python-dev I thought is is the best to discuss this
here. And I assume that someone else had the same idea then me before.
Maybe you can point me to the relevant discussion/ticket.
I read about Intels hybrid CPUs. It means there are multiple cores e.g.
8 high-speed cores and 8 low-speed (but more energy efficient) cores
combined in one CPU.
In my use cases I do parallelize with Pythons multiprocessing package to
work on millions of rows on pandas.DataFrame objects. This are task that
are not vecotrizable. I simple cut the DataFrame horizontal in pieces
(numbered by the available cores).
But when the cores are different in there "speed" I need to know that.
e.g. with a 16 core CPU where half of the cores low/slow and every core
has 1 million rows to work on. The 8 high speed cores are finishing
earlier and just waiting untill the slow cores are finished. It would be
more efficient if the 8 high speed cores each would work on 1,3 million
rows and t... continue reading
Let's imagine I have an algorithm which depends on a context variable.
I write an algorithm (elided below for space) which depends on it. Then I realize that I can improve the performance of my algorithm by using concurrent.futures. But my algorithm will change its behaviour because it does not inherit the context. Simply trying to parallelize an "embarrassingly parallel" algorithm changes its behaviour.
What I really want is a stack-scoped variable: a variable which retains its value for all child scopes whether in the same thread or not, unless it is overwritten in a child scope (whether in the same thread or not).
from decimal import getcontext
import concurrent.futures
def my_algorithm(input):
# some real algorithm here, which relies on decimal precision
return getcontext().prec
getcontext().prec = 8
vals = map(my_algorithm, range(0, 10))
print(list(vals))
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
# Start the load operations and mark... continue reading
I bet I am not alone.
Instead of going silently, I wanted to call on the adult supervision
to do something about the adult.
Hi,
We would like to know if there is any option available to execute and debug( setting break point and delete break point) C/C++ Source files Python API's inside Eclipse IDE after interfacing Pydev with Eclipse.
Please let us know.
Thanks and regards.
Chandrakant shrimantrao.
L&T Technology Services Ltd
L&T Technology Services Limited (LTTS) is committed to safeguard your data privacy. For more information to view our commitment towards data privacy under GDPR, please visit the privacy policy on our website www.Ltts.com. This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
We’re happy to announce the general-availability
https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability
of sqlalchemy-bigquery
https://googleapis.dev/python/sqlalchemy-bigquery/latest/index.html
version 1.0.0, the Google BigQuery dialect for SQLAlchemy
https://www.sqlalchemy.org/, allowing SQLAlchemy to be used with
BigQuery, including schema definition, querying and schema migration with
Alembic https://alembic.sqlalchemy.org/en/latest/.
This release builds on and replaces the earlier pybigquery
https://pypi.org/project/pybigquery/ project.
The release can be installed from PyPI
python -m pip install sqlalchemy-bigquery==1.0.0
Please share any feedback as an issue on GitHub:
https://github.com/googleapis/python-bigquery-sqlalchemy/issues
Thanks!
Hi All,
I use clangd. Clangd creates a .cache directory, and there are also
tools for generating a compile_commands.json file which tells clangd how
to behave. I did a quick check, and there are no naming collisions with
other files in the cpython project.
What does everyone think? Can we add these two items to the .gitignore:
.cachecompile_commands.json--
Thanks!
Jack DeVries
Hi all,
I have submitted PEP 667 as an alternative to PEP 558.
https://www.python.org/dev/peps/pep-0667/
Nick and I have agreed to disagree on the way to fix locals() and
f_locals. We are both in agreement that it needs fixing.
In summary, PEP 667 has roughly the same surface behavior as PEP 558 but
is simpler and more consistent internally, at the expense of some minor
C API backwards incompatibility issues.
PEP 558 also has backwards incompatibility issues, but claims to be more
compatible at the C API level.
Cheers,
Mark.
ACTIVITY SUMMARY (2021-08-13 - 2021-08-20)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7398 ( +5)
closed 49298 (+49)
total 56696 (+54)
Open issues with patches: 2928
#41322: unittest: deprecate test methods returning non-None values
https://bugs.python.org/issue41322 reopened by serhiy.storchaka
#44913: segfault in call to embedded PyModule_New
https://bugs.python.org/issue44913 opened by enometh
#44915: Python keywords as string keys in TypedDict
https://bugs.python.org/issue44915 opened by Doug Hoskisson
#44918: Unhandled Exception (Not Implemented) in HTMLParser().feed
https://bugs.python.org/issue44918 opened by md103
#44919: TypedDict subtypes ignore any other metaclasses in 3.9+
https://bugs.python.org/issue44919 opened by sobolevn
#44920: Support UUIDv6, UUIDv7, and UUIDv8 from th... continue reading
Hello,
In _collections_abc.py is a private function titled _check_methods.
It takes a class and a number of method names (as strings), checks if
the class has all of the methods, and returns NotImplemented if any
are missing. The code is below:
def _check_methods(C, *methods):
mro = C.__mro__
for method in methods:
for B in mro:
if method in B.__dict__:
if B.__dict__[method] is None:
return NotImplemented
break
else:
return NotImplemented
return True
This is an incredibly convenient function (referred to as
check_methods here on out) for creating abstract base classes, and is
much simpler than using hasattr for each method you want to check.
For example:
>>> from abc import ABCMeta
>>> # Without check_methods
>>> class A(metaclass=ABCMeta):
... @classmethod
... def __subclasshook__(cls, subclass):
... return (hasattr(subclass, 'foo') and
... ... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/HGYBHDH6ZCSYUERI55R6JQSJMX52NNR7/)
Dear developers,
According to the Language Reference, a starred expression is defined
by
starred_expression ::= expression | (starred_item ",")* [starred_item]
https://docs.python.org/3/reference/expressions.html#expression-lists
However, in view of the definition of an assignment statement
assignment_stmt ::= (target_list "=")+ (starred_expression |
yield_expression)
https://docs.python.org/3/reference/simple\_stmts.html#assignment-statements
I believe the correct definition actually used is
starred_expression ::= expression | (starred_item ",")+ [starred_item]
(that is, use "+" instead of "*").
Should it be fixed?
Best regards,
Takuo Matsuoka
💐💐😉😊💐💐
☕ Cheer Up! 🍵
🍂 ✨ )) ✨ 🍂
🍂┃ (( * ┣┓ 🍂 we have a python3 -m pip install pygame==2.0.2.dev2
🍂┃*💗 ┣┛ 🍂
🍂┗━━┛ 🍂
🎂 For YOU 🍰
💐💐😌😊💐💐
Hello internet strangers. We’re back with a new release, packed with tons
of mundane bug fixes and unexciting improvements! It’s been a while since
the last release, but in that time pygame development has been moving
ahead. This release, 36 contributors (25 new ones!) contributed over 75
pull requests. Since 2.0.1, over 200 files were edited, with more than
16,000 lines added, and more than 7,000 lines deleted.
This is a development pre-release, so we can test out new release
machinery. Probably we will do a couple more dev pre-releases, but we hope
to have a full 2.0.2 release soon. There's a bunch of PRs still open that
we want to help resolve and merge in before that.
So grab a beverage,
and doom scroll our release notes,
we prepared just for you,
... [continue reading](https://mail.python.org/archives/list/python-announce-list@python.org/thread/WFKC73FM7HKILXARAFEY5SOI2FTXVRIM/)
Hello developers.
I like star expression.
It would be even better if we could extend the idea of PEP448 to
provide the following syntax at the time of assignment.
a, b, d, **\_ = **{"a":0, " b":1, "c":2}, d=3
Ideally, it would be nice to be able to provide the same syntax when
calling the function.
I think this applies to the zen of python called "There should be
one-- and preferably only one --obvious way to do it.".
a, *args, b, **kwargs = 1, 2, *[3,4], **{"b", 4}, c=4
(
a: str,
*args,
b: list = [],
**kwargs
) = 1, 2, *[3,4], **{"b", 4}, c=4
func = lambda(
a: str,
*args,
b: list = [],
**kwargs
): print(a, b)
But it would be difficult because it would conflict with various
syntaxes(etc. PEP 3132).
We may have to declare it explicitly to avoid confusion.
For example, prepare a keyword for unpack the positional arguments and
keyword arguments at the same time.
a, *args, b, **kwargs = ***(1, 2, *[3,4], **{"b", 4}, c=4)
You c... continue reading
Greetings, all!
After petitioning the Steering Council I have been added as a moderator for the Python Dev mailing list. I was already
the moderator of four other Python lists.
My goal as a moderator is to have our forums be civil and within the CoC. I do rely heavily on users to let me know if
someone may be crossing the line.
For the record, I do feel I can be impartial even when I am the target of attacks -- I don't think I deserve any special
treatment, so such things will be handled the same as if any other community member were the target.
--
~Ethan~
Moderator
After reviewing the "Problems with dict subclassing performance" thread, I am suspending Marco Sulla from Python-Dev for
a period of three months. His behavior became blatantly inappropriate, and rather than apologize he continued taunting
those that were trying to help him.
Marco took exception to Steven D'Aprano's post, but I see nothing in Steven's post in either style or substance that
warrants any moderator attention.
--
~Ethan~
Moderator
Hey everyone,
As part of PEP 588, migrating bugs.python.org issues to Github, there
are two current mailing list related items that need a replacement or
need to be turned down.
Weekly summary emails with bug counts and issues from the week,
example: https://mail.python.org/archives/list/python-dev@python.org/thread/JRFJ4QH7TR35HFRQWOYPPCGOYRFAXK24/
Emails sent to the new-bugs-announce and python-bugs-list for new
issues and comments to existing issues.
I wanted to quickly gauge if anyone is relying on these mailing
lists/emails or if it's a convenient part of your workflow. Feel free
to chime in here or on the migration issues directly with your
use-case:
Thanks,
Ammar
At the moment, the handling of NANs in the statistics module is
implementation dependent. In practice, that usually means that if your
data has a NAN in it, the result you get will probably be a NAN.
>>> statistics.mean([1, 2, float('nan'), 4])
nan
But there are unfortunate exceptions to this:
>>> statistics.median([1, 2, float('nan'), 4])
nan
>>> statistics.median([float('nan'), 1, 2, 4])
1.5
I've spoken to users of other statistics packages and languages, such as
R, and I cannot find any consensus on what the "right" behaviour should
be for NANs except "not that!".
So I propose that statistics functions gain a keyword only parameter to
specify the desired behaviour when a NAN is found:
raise an exception
return NAN
ignore it (filter out NANs)
which seem to be the three most common preference. (It seems to be
split roughly equally between the three.)
Thoughts? Objections?
Does anyone have any strong feelings about what should be the def... continue reading
Don't know if this is already a PEP, but I'd love to see something like this
https://www.codementor.io/@arpitbhayani/overload-functions-in-python-13e32ahzqt
in
Python— a decorator @overload that creates multiple copies of
functions/methods based on their arguments' types. (This is much narrower
in scope than PEP 3124, before anyone asks.)
Dear Developers,
Some of you may have noticed I updated my proposal on the subject
yesterday. I'm afraid it was too long without a summary, so here is
one. I hope this will be helpful to some people.
(1) Simplify the syntax:
We wouldn't need the notion of expression list any more, and would
be able to use starred expressions at more places.
(2) Simplify the syntax about subscription and slicing:
A simple new rule describes a well expectable interpretation of
natural but currently invalid expressions (mainly those involving
stars) which extends the already given interpretation of already
valid expressions.
(3) There's a difference from PEP 646:
Unlike with PEP 646, we won't have e.g.,
a[*[y]]
as a valid expression which is \_not\_ equivalent to
a[y]
The origianal post (sorry about its length) can be found at
https://mail.python.org/archives/list/python-ideas@python.o... continue reading
Dear colleagues,
We are very happy to announce the v4.3 release of the Astropy package,
a core Python package for Astronomy:
Astropy is a community-driven Python package intended to contain much
of the core functionality and common tools needed for astronomy and
astrophysics. It is part of the Astropy Project, which aims to foster
an ecosystem of interoperable astronomy packages for Python.
New and improved major functionality in this release includes:
PyCA cryptography 3.4.8 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more. We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog.html#v3-4-8):
-Paul Kehrer (reaperhulk)
All,
After some consideration at our weekly meeting (this monday), and a
recommendation from the Conduct WG (last friday), the Steering Council has
decided to ban Marco Sulla from all Core Developer spaces for at least a
year. (For the record, Brett abstained from voting on this issue.) We also
agreed to add Ethan to the python-dev moderators, who's already taken the
more specific action of banning Marco from python-dev for 3 months. If
anyone else is interested in assisting with moderation on python-dev,
please let us know.
Marco wasn't solely responsible for how bad some of the discussion went,
but his messages were the ones that clearly crossed the line, both in tone
and in language, and it isn't the first time; as he's already pointed out,
he was previously banned from discuss.python.org for the same kind of
behaviour. We do want to admonish and encourage everyone who participated
in the discussions to reconsider their posts. We've heard from quite a lot
of people how badly the w... continue reading
I just noticed that PEP 8 has quite a few references to Python 2. Perhaps
it's time to remove those.
There are more and more folks that have never learned or used Python 2 --
having those notes in PEP 8 is just confusing.
And for folks that are still maintaining Py 2 code -- it's probably too
late for PEP 8 for those code bases anyway.
If I make a PR, will it be considered?
-CHB
--
Christopher Barker, PhD (Chris)
Python Language Consulting
Currently Python does not support using @staticmethod decorator along with @property decorator.
I think that the it currently works is a bit misleading since it will not give an error, but gives the following outcome.
class Foo:
@staticmethod
@property
def bar():
return "1"
class Foo:
@property
@staticmethod
def bar():
return "1"
In wither of the cases the outcome is the following
Foo.bar
>>> <property at 0x112dbaf40>
a = Foo()
a.bar
>>> <property at 0x112dbaf40>
Is there any particular reason for this? Any don't we make it work?
I just wanted to apologize for any angst or noise my replies to Marco
caused folks. I should have known that correcting Marco on how to address
me would have triggered an outsized reply (the real intent of that overall
email was to communicate the process of banning someone to the rest of the
list so people didn't leave faster than we addressed it; obviously didn't
work). It appears my judgement was more impaired than I realized while I
have been sick.
As such, I have amended my rules for when I don't read OSS emails (this
excludes SC business):
I have actually gone as far as to separate my personal email and OSS/
python.org email accounts into separate email providers so that I can
enforce this separation cleanly.
As I was working on removing Python 2 references from PEP 8 (PR:
https://github.com/python/peps/pull/2059), I tried to avoid any other
copy-editing.
However, I noted a few things that maybe could use some attention:
stdlib or not?
##########
Right at the top, it says:
"This document gives coding conventions for the Python code comprising the
standard library in the main Python distribution."
However, it has become a de facto standard for all Python code, and in the
document itself, there is frequent wording akin to "Identifiers used in the
standard library must be ASCII compatible ...", and even advice for third
party libraries.
Which I think is acknowledging that PEP 8 is indeed not only about the
standard library.
So maybe there should be a bit of text about that at the top.
Name Mangling
#############
In the sections on "Method Names and Instance Variables" and "Designing for
Inheritance", the discussion of name mangling (leading __ names) is a bit
redundant. Nothing inco... continue reading
Currently, when what to execute external command, either os.system() or subprocess functions should be invoked.
However, it is not so convenient, it would be nice to use "``" symbol to brace the shell command inside.
like:
stdout_result_str = cat file.txt \| sort \| grep hello
Its is enhanced feature which combine both subprocess and os.system
Because, subprocess can return output of file, but does not support pipe in command.
While os.system can apply pipe in command but doesn't support return stdout result.
This can be very convenient to make python available for some build script which ruby now do well like homebrew ...
simply
echo hello \| wc -l while only execute command and the result will just like other unassigned expression, the result will be finally discarded.
There won't be big difficulties to implement.
Currently, pickle can only save some very simple data types into bytes.
And the object itself contains reference to some builtin data or variable, only reference will be saved.
I am wondering if it is possible recursively persist all the data into pickle representation. Even if some data might be builtin function of variable, it will represent it in very raw (memory level).
If it contains function it will persist all its attribute, and code object.
Method-wrapper and all its attribute will be persist entirely.
If it contains two attribute with same memory location id(x) is same, then they can be persist as one, and reference each other.
For example, if user pickle recursively dump a numpy ndarray into a pickle file, when user pickle load this file from a system which doesn't install numpy, its method should all works properly like transpose, reshape ...
When applying recursively dump, the output pickle file or bytes might be very large.
All related memory data will be dumped.... continue reading
ACTIVITY SUMMARY (2021-08-20 - 2021-08-27)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7413 (+15)
closed 49352 (+54)
total 56765 (+69)
Open issues with patches: 2935
#42085: Add dedicated slot for sending values
https://bugs.python.org/issue42085 reopened by pablogsal
#44964: Semantics of PyCode_Addr2Line() changed
https://bugs.python.org/issue44964 opened by pablogsal
#44969: Subclassing of annotated types does not always work
https://bugs.python.org/issue44969 opened by serhiy.storchaka
#44970: Re-examine complex pow special case handling
https://bugs.python.org/issue44970 opened by mark.dickinson
#44972: Add workflow_dispatch trigger for GitHub Actions jobs
https://bugs.python.org/issue44972 opened by rmast
#44974: Warning about "Unknown child process pid" in test_asyncio
https://b... continue reading
Hello,
I developed a C sorting algorithms library that currently has a few
dozens of algorithms and thousands of variants when choosing
parameters (like threshold for switching to insertion sort, etc.).
(I compile each variant on demand in custom tests
to avoid having a bloated source file.)
My benchmarks could be improved but however I found that Shivers' sort
and adaptive Shivers' sort (aka Jugé's sort) performs better than
Tim's sort.
I don't know if it will still be true with the benchmarks in Python.
If you're open to the idea that maybe Tim's sort can be improved and
are willing to benchmark it, it can be done easily by switching the
main natural merge strategy like I did here :
https://github.com/LLyaudet/TSODLULS/commit/2968c4b4ca58ae794157dc9636ed87017e5f7a17
The relevant code is not very long :
/**
Hello everyone. I’m happy to announce version 0.13.0 of PyData/Sparse.
PyData/Sparse provides sparse arrays for the PyData ecosystem: It mimics the NumPy API but provides sparse storage.
Version 0.13.0 was mainly a bugfix-centred release, fixing many bugs and regressions reported by users for versions 0.12.0 and 0.11.0.
Python 3.6 was dropped for this release, and version 3.9 support was formally added. Some minor features were also added.
Source Code: https://github.com/pydata/sparse/tree/0.13.0 https://github.com/pydata/sparse/tree/0.13.0
Documentation: https://sparse.pydata.org/en/0.13.0/ https://sparse.pydata.org/en/0.13.0/
Changelog: https://sparse.pydata.org/en/0.13.0/changelog.html https://sparse.pydata.org/en/0.13.0/changelog.html
Best regards,
Hameer Abbasi
If you look at
https://github.com/python/cpython/blob/b11a951f16f0603d98de24fee5c023df83ea552c/Python/ceval.c#L2409-L2451
you will see that async for requires that the iterator returned from
\_\_aiter\_\_ define \_\_anext\_\_. But if you look at aiter() which uses
PyObject_GetAiter() from
https://github.com/python/cpython/blob/f0a6fde8827d5d4f7a1c741ab1a8b206b66ffd57/Objects/abstract.c#L2741-L2759
and PyAiter_Check() from
https://github.com/python/cpython/blob/f0a6fde8827d5d4f7a1c741ab1a8b206b66ffd57/Objects/abstract.c#L2769-L2778
you will notice that aiter() requires \_\_anext\_\_ and \_\_aiter\_\_ on the
async iterator that gets returned from __aiter__.
Now the docs for aiter() at
https://docs.python.org/3.10/library/functions.html#aiter points out that
the async iterator is expected to define both methods as does the glossary
definition for "asynchronous iterator" (
https://docs.python.org/3.8/glossary.html#term-asynchronous-iterator).
So my question is whether t... continue reading
Hi everyone,
I’m happy to announce the release of argon2-cffi 21.1.0!
With more than 13 million downloads per month, argon2-cffi is the most popular package for using the competition-winning Argon2 password hash in Python.
If you want more details on Argon2 and why it matters, check out my blog post "Storing Passwords in a Highly Parallelized World" https://hynek.me/articles/storing-passwords/.
Heartfelt thanks go to my generous GitHub sponsors https://github.com/sponsors/hynek, companies subscribing on Tidelift https://tidelift.com/subscription/pkg/pypi-argon2-cffi (currently nobody :( – tell your boss!), and people who bought me a coffee on https://ko-fi.com/the\_hynek!
Support like that makes me work on FOSS on a Sunday afternoon, so please consider supporting me https://hynek.me/say-thanks/ too! <3
The highlights of this release are:
All Changes:
======... continue reading
pytest 6.2.5 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at
https://docs.pytest.org/en/stable/changelog.html.
Thanks to all of the contributors to this release:
Happy testing,
The pytest Development Team
Hi there python-ideas - I've been teaching Python as a first
programming language for a few years, and from that experience I want
to propose a change to PEP8. I'm sure the default position for PEP8 is
to avoid changing it. However, for this one rule I think a good case
can be made to make it optional, so let me know what you think.
Let me start with what I've learned from teaching students in Java and
now in Python. In Java, you use == for ints, but you need to use
equals() for strings. Of course students screw this up constantly,
using == in a context that calls for equals() and their code does not
work right. Then for Java arrays a different comparison function is
required, and so it goes. To teach comparisons in Python, I simply say
"just use ==" - it works for ints, for strings, even for lists.
Students are blown away by how nice and simple this is. This is how
things should work. Python really gets this right.
So what is the problem?
The problem for Python is what I will call ... continue reading
Python 3.9.7
Get it here: https://www.python.org/downloads/release/python-397/ https://www.python.org/downloads/release/python-397/
Python 3.9.7 is the newest major stable release of the Python programming language, and it contains many new features and optimizations. There’s been 187 commits since 3.9.6 which is a similar amount compared to 3.8 at the same stage of the release cycle. See the change log https://docs.python.org/release/3.9.7/whatsnew/changelog.html for details.
On macOS, we encourage you to use the universal2 binary installer variant whenever possible. The legacy 10.9+ Intel-only variant will not be provided for Python 3.10 and the universal2 variant will become the default download for 3.9.8. You may need to upgrade third-party components, like pip, to later versions. You may experience differences in behavior in IDLE and other Tk-based applications due to using the newer version of Tk. As always, if you encounter problems when using this installer variant, pleas... continue reading
Python 3.9.7
Get it here: https://www.python.org/downloads/release/python-397/ https://www.python.org/downloads/release/python-397/
Python 3.9.7 is the newest major stable release of the Python programming language, and it contains many new features and optimizations. There’s been 187 commits since 3.9.6 which is a similar amount compared to 3.8 at the same stage of the release cycle. See the change log https://docs.python.org/release/3.9.7/whatsnew/changelog.html for details.
On macOS, we encourage you to use the universal2 binary installer variant whenever possible. The legacy 10.9+ Intel-only variant will not be provided for Python 3.10 and the universal2 variant will become the default download for 3.9.8. You may need to upgrade third-party components, like pip, to later versions. You may experience differences in behavior in IDLE and other Tk-based applications due to using the newer version of Tk. As always, if you encounter problems when using this installer variant, pleas... continue reading
Hi all,
PEP 535 was deferred until Python 3.8. I would like to discuss the PEP given that some time has passed, and I _personally_ would benefit from its acceptance.
As a reasonably long-time Python user (well, 16 years), I have gradually moved from using only the core language to working within the DSLs (NumPy et al.) of the Scientific Python ecosystem. Most recently, I've been using Awkward Arrray (https://github.com/scikit-hep/awkward-1.0), which generalises the regular NumPy array programming paradigm into "jagged" data structures, and was initially aimed at the High Energy Physics (HEP) domain.
Various aspects of NumPy's API have become a "lingua-franca" in the Scientific Python domain, such as strongly-overloaded index operations. One such overload allows "mask arrays" — arrays with boolean entries corresponding to a per-element mask — to select a subset of the array. These mask arrays are conveniently bui... continue reading
Maybe I'm missing something, but I don't think that there is anyway to
remove a warning from the warnings filter list so that it will be shown
again.
Example:
>>> import warnings
>>> warnings.warn("something happened")
<stdin>:1: UserWarning: something happened
>>> warnings.warn("something happened")
>>>
Once a warning has been displayed, it won't be displayed again until you
exit the interpreter and start a new session. That's usually what we
want, but sometimes I do want to re-display the warning.
The warnings module has a function, reset_warnings, but it does too
much, removing all the filters including those set at interpreter
startup. I'd like a function to remove a single item, something like
this:
>>> warnings.warn("something happened")
<stdin>:1: UserWarning: something happened
>>> warnings.warn("something happened")
>>>
>>> warnings.forget(UserWarning("something happened"))
>>> warnings.warn("something happened")
<s... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/IJYNSHWPUBZGC2RNPJ6NMRPN5N56OL4D/)
Given code like this:
d = {1: {2: {3: 4}}}
print(d[1][2][3])
d[1][2][3] = None
print(d)
It should be possible to rewrite it using a starred expression, like this:
d = {1: {2: {3: 4}}}
keys= 1,2,3
print(d[*keys])
d[*keys] = None
print(d)
Hopefully it's clear from that example what I'm suggesting.
Wing 8.0.3 allows specifying the Django settings module for unit tests
with --settings=<name> in Run Args on the Testing page of Project
Properties, fixes using an Activated Env that contains spaces in its
path, prevents failure to reformat code on remote hosts and containers,
fixes searching in files with non-ascii characters, and makes several
other improvements.
Details: https://wingware.com/news/2021-08-31
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and include... continue reading
Over in https://bugs.python.org/issue45020 there is some exciting work
around expanding the use of the frozen importer to speed up Python
interpreter startup. I wholeheartedly support the effort and don't want to
discourage progress in this area.
Simultaneously, I've been down this path before with PyOxidizer and feel
like I have some insight to share.
I don't think I'll be offending anyone by saying the existing CPython
frozen importer is quite primitive in terms of functionality: it does the
minimum it needs to do to support importing module bytecode embedded in the
interpreter binary [for purposes of bootstrapping the Python-based
importlib modules]. The C struct representing frozen modules is literally
just the module name and a pointer to a sized buffer containing bytecode.
In issue45020 there is talk of enhancing the functionality of the frozen
importer to support its potential broader use. For example, setting
__file__ or exposing .__loader__.get_source(). I support ... continue reading
There are two different kinds of TypeError: if the end user passes an
instance of wrong type and if the author of the library makes an error
in implementation of some protocols.
For example, len(obj) raises TypeError in two cases: if obj does not
have __len__ (user error) and if obj.returns non-integer (implementation
error). for x in obj raises TypeError if obj does not have __iter__
(user error) and if iter(obj) does not have __next__ (implementation error).
User errors can be fixed on user side, implementation errors can only be
fixed by the author of the class. Even if the user and the author is the
same person, these errors point to different places of code.
Would it be worth to add a special TypeError subclass for implementation
errors to distinguish them from user errors? How to name it
(ImplementationError, ProtocolError, etc)?
the way to make an (aysnc)generator that immediately raises Stop(Async)Iteration immediately is to insert an unreachable yield statement, however there's two ways to do it:
def example():
if False:
yield
or:
def example():
return
yield
currently test_asyncgen.py uses both, eg:
@types.coroutine
def \_\_anext\_\_(self):
if False:
yield "this is a generator-based coroutine"
if self.yielded >= 2:
raise StopAsyncIteration()
else:
self.yielded += 1
return self.yielded
or:
async def agenfn():
try:
await \_async\_yield(1)
except MyError:
await \_async\_yield(2)
return
yield
the if False: yield version has a disadvantage in that it can be anywhere in the function, if this one is chosen then an additio... continue reading
Some weeks ago I started the idea of Template Literals for Python:
https://github.com/guettli/peps/blob/master/pep-9999.rst
I just switched to a new company (descript.de) and diving into their context
will need some time.
This means I won't work on the Template Literals PEP.
If you like the idea, then it would be great if you work on it.
Regards,
Thomas
ACTIVITY SUMMARY (2021-08-27 - 2021-09-03)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7409 ( -4)
closed 49419 (+67)
total 56828 (+63)
Open issues with patches: 2945
#20658: os.environ.clear() fails with empty keys (posix.unsetenv)
https://bugs.python.org/issue20658 reopened by iritkatriel
#37330: open(): remove 'U' mode, deprecated since Python 3.3
https://bugs.python.org/issue37330 reopened by vstinner
#45033: Calls to PyErr_PrintEx in destructors cause calling async func
https://bugs.python.org/issue45033 opened by zbentley
#45034: Improve struct.pack out of range error messages
https://bugs.python.org/issue45034 opened by steven.daprano
#45035: sysconfig's posix_home scheme has different platlib value to d
https://bugs.python.org/issue45035 opened by uranusjr
#45036: turtle.onrelea... continue reading
Dear Pythonistas and solar power enthusiasts,
On behalf of the maintainers, we're happy to announce a new release of
pvlib python:
software for simulating performance of photovoltaic solar energy systems.
See what's new for v0.9.0:
Releases are available from PyPI and the conda-forge channel:
Read the Documentation:
Report issues & contribute:
Highlights:
Python 3.7.12 and 3.6.15, the lastest security fix rollups for Python 3.7 and Python 3.6, are now available. You can find the release files, links to the changelogs, and more information here:
https://www.python.org/downloads/release/python-3712/
https://www.python.org/downloads/release/python-3615/
These releases are source code only; Windows and macOS binary installers are not provided for security fix releases.
Note that Python 3.9 is now the latest feature release series of Python 3. You should consider upgrading to 3.9 as soon as practical. Get the latest release of 3.9.x here:
https://www.python.org/downloads/
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.
https://www.python.org/psf-landing/
--
Ned Deily
nad@python.org -- []
Hi
I’d like to raise awareness to the two b.p.o. entries I recently created and their corresponding PRs:
sysconfig's posix_user scheme has different platlib value to distutils's unix_user
https://bugs.python.org/issue44860
Tzu-ping Chung (@uranusjr)
uranusjr@gmail.com
https://uranusjr.com
Hi all,
the product of Sunday morning idle curiosity...
I’ve been using the csv module a lot, and I’m wondering if there would be value in adding a standard mechanism for opening a CSV file (correctly) using a context manager?
So, instead of
with open(filename, newline=“”) as fp:
r = csv.DictReader(fp)
for row in r:
…
support something like
with csv.DictReader.open(filename) as r:
for row in r:
…
? And something similar for ‘csv.reader’? I’m not wedded to the details here.
The two main reasons I think this might be a positive addition are -
but perhaps there are things I’m missing here?
As a side note, I think ‘csv.reader’ could usefully be renamed to something else (maybe just Reader?), since it’s kind of out of sync with the CamelCase used in ‘DictReader’. But maybe that’s just an attempt at foolish consistenc... continue reading
Hello all,
In Python 3.10 and 3.11, exception tracebacks are being greatly improved. I
noticed that there's nothing related to a fairly common (in my personal
experience) cryptic traceback relating to the with statement:
with ContextManager as ctx:
... # do something withctx
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: __enter__
This occurs when one forgets to use a instance of a context manager class
and uses the class itself. It's obviously not a very helpful traceback.
("Is it not a context manager?" "Is it the wrong class?") Something like
the following would be better.
with ContextManager as ctx:
... # do something withctx
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: <type Context manager> is not a context manager. Did you
mean "with ContextManager()..."?
The actual traceback message should probably be more specific than "<type
Context manager> is not a ... continue reading
When writing some unit tests with the standard Unittest library, I missed being able to create parameterized tests. This functionality exists in PyTest (https://docs.pytest.org/en/6.2.x/parametrize.html) and there is also a library called parameterized(https://github.com/wolever/parameterized) which aims to add this functionality.
However, I think it would be beneficial to have a decorator in Python's standard Unittest library.
Note: If this functionality exists natively in Python, please put some example or documentation link below.
Thanks in advance.
Currently, in Python 3.9, dbm.open(), dbm.gnu.open() and dbm.ndbm.open() doesn't support path-like object, class defined in pathlib.
It would be nice to add support with it.
Sent with ProtonMail Secure Email.
functools introduces partial function. As I can see from the implementation, partial functions are instance of partial class, and that __call__ is used to "emulate" a function call.
On the other hand I guess people usually treat those as ordinary functions.
The thing here is that for functions people expect to see the __name__ attribute defined and it can be useful in many cases.
Why partial does not have a __name__ property and why is it not a good idea to add one?
Python 3.10 is one month away, can you believe it? This snake is still
trying to bite as it has been an interesting day of fighting fires, release
blockers, and a bunch of late bugs but your friendly release team always
delivers :)
You can get this new release while is still fresh here:
https://www.python.org/downloads/release/python-3100rc2/
This is the second release candidate of Python 3.10
This release, 3.10.0rc2 , is the last preview before the final release
of Python 3.10.0 on 2021-10-04. Entering the release candidate phase, only
reviewed code changes which are clear bug fixes are allowed between release
candidates and the final release. There will be no ABI changes from this
point forward in the 3.10 series and the goal is that there will be as few
code changes as possible.
The next release will be the final release of Python 3.10.0, which is
currently scheduled for Monday, 2021-10-04.
Call to action
⚠️⚠️⚠️⚠️⚠️⚠️⚠️
*The 3.10 branch is now acce... continue reading
Python 3.10 is one month away, can you believe it? This snake is still
trying to bite as it has been an interesting day of fighting fires, release
blockers, and a bunch of late bugs but your friendly release team always
delivers :)
You can get this new release while is still fresh here:
https://www.python.org/downloads/release/python-3100rc2/
This is the second release candidate of Python 3.10
This release, 3.10.0rc2 , is the last preview before the final release
of Python 3.10.0 on 2021-10-04. Entering the release candidate phase, only
reviewed code changes which are clear bug fixes are allowed between release
candidates and the final release. There will be no ABI changes from this
point forward in the 3.10 series and the goal is that there will be as few
code changes as possible.
The next release will be the final release of Python 3.10.0, which is
currently scheduled for Monday, 2021-10-04.
Call to action
⚠️⚠️⚠️⚠️⚠️⚠️⚠️
*The 3.10 branch is now accepting changes for 3.10.... continue reading
I always thought that the "deprecated" directive is used if the term of
removing the deprecated feature is not set yet, and the
"deprecated-removed" directive is used if it is set. After removing the
feature both directives are replaced with the "versionchanged" directive
which only specifies the version of removing, not version of deprecation.
But after reading the devguide [1] I am no longer so confident. The
devguide clearly describes it as specifying version at which the feature
"is" removed, not "will be" removed. Maybe I always used this directive
incorrectly? Or its meaning was changed with time? Or I incorrectly
understand the devguide wording? Or devguide is incorrect?
Before 3.8 I only seen "deprecated-removed" with future removing
version. The first use "deprecated-removed" for feature which is already
deleted happened in 3.8 (maybe the directive was just not updated), and
there are now many uses for features removed in asyncio in 3.10.
What was the initial meaning of "de... continue reading
Hey,
I noticed that writing a class with a classmethod \_\_eq\_\_, it does not work as expected:
class ANY:
@classmethod
def \_\_eq\_\_(cls, other):
return True
assert ANY == 2 # succeeds
assert ANY == 2 # fails
This is, to my understanding, because ANY == 2 translates into type(ANY).\_\_eq\_\_(2).
However, I think it would be useful to allow user implementation of classmethod dunder methods that work as expected, or at least put a big disclaimer in the documentation. I am not sure how difficult this would be to do, but I imagine that type could check if the given object/class has a classmethod __eq__ and if so use it as a replacement for type(obj).\_\_eq\_\_
As a sidenote, I think it would actually be kinda cool to have the typing.Any behave this way, i.e. always comparing to True.
One example where this would be useful is that it would allow comparisons like
assert mytuple == (Any, "abc")
which would then be e... continue reading
Hi,
For 1 or 2 years, I'm getting spam messages from "Daniel Scott". It
started with empty replies to multiple Python mailing lists. Mailing
list owners: please block his email address. I never ever saw any
useless message from this name (sorry if a real Daniel Scott plans to
contribute to Python and will be blocked by mistake).
Today, I got an email to my @python.org email account.
And "Daniel Scott" also commented a closed issue:
"I left you to see conduct on phython assigned."
https://github.com/python/cpython/pull/23734#issuecomment-916568696
SPAM SPAM SPAM SPAM SPAM SPAM SPAM
What can we do to reduce the spam?
For GitHub, I reported the comment as a spam:
(o) I want to report abusive content or behavior
=> I want to report SPAM, a user that is disrupting me or my
organization's experience on GitHub, or a user who is using my
personal information without my permission
==> A user's profile or repository is SPAM.
In the comment, I added a link to this email :-)
"Daniel": Ple... continue reading
My proposal is that iterating through a member of a Flag enum will return all the constituent members.
Demonstration Setup:
class FlagEnum(enum.Flag):
A = enum.auto()
B = enum.auto()
C = enum.auto()
FlagCombo = FlagEnum.A | FlagEnum.B
My proposed change would cause the following to occur:
print(list(FlagCombo))
[FlagEnum.B, FlagEnum.A]
print(list(FlagEnum.A))
[FlagEnum.A]
Compared to the current implementation:
print(list(FlagCombo))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'FlagEnum' object is not iterable
What do you all think?
ACTIVITY SUMMARY (2021-09-03 - 2021-09-10)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7376 (-33)
closed 49524 (+105)
total 56900 (+72)
Open issues with patches: 2929
#36550: Avoid creating AttributeError exceptions in the debugger
https://bugs.python.org/issue36550 reopened by iritkatriel
#45083: Need to use the exception class qualname when rendering except
https://bugs.python.org/issue45083 reopened by vstinner
#45089: [sqlite3] the trace callback does not raise exceptions on erro
https://bugs.python.org/issue45089 reopened by petr.viktorin
#45096: Update Tools/freeze to make use of Tools/scripts/freeze_module
https://bugs.python.org/issue45096 opened by eric.snow
#45098: asyncio.CancelledError should contain more information on canc
https://bugs.python.org/issue45098 opened by dreams... continue reading
PEP 663 is presented below for your viewing pleasure.
Comments, questions, and concerns are welcome.
PEP: 663
Title: Improving and Standardizing Enum str(), repr(), and format() behaviors
Version: $Revision$
Last-Modified: $Date$
Author: Ethan Furman ethan@stoneleaf.us
Discussions-To: python-dev@python.org
Status: Draft
Type: Informational
Content-Type: text/x-rst
Created: 23-Feb-2013
Python-Version: 3.11
Post-History: 20-Jul-2021 10-Sep-2021
Resolution:
Now that we have a few years experience with Enum usage it is time to update
the repr(), str(), and format() of the various enumerations by their
intended purpose.
The addition of StrEnum with its requirement to have its str() be its
value is inconsistent with other provided Enum's str.
Having the str() of IntEnum and IntFlag not be the value causes
bugs and extra w... continue reading
PEP 663 is presented below for your viewing pleasure.
Comments, questions, and concerns are welcome.
PEP: 663
Title: Improving and Standardizing Enum str(), repr(), and format() behaviors
Version: $Revision$
Last-Modified: $Date$
Author: Ethan Furman ethan@stoneleaf.us
Discussions-To: python-dev@python.org
Status: Draft
Type: Informational
Content-Type: text/x-rst
Created: 23-Feb-2013
Python-Version: 3.11
Post-History: 20-Jul-2021 10-Sep-2021
Resolution:
Now that we have a few years experience with Enum usage it is time to update
the repr(), str(), and format() of the various enumerations by their
intended purpose.
The addition of StrEnum with its requirement to have its str() be its
value is inconsistent with other provided Enum's str.
Having the str() of IntEnum and IntFlag not be the value causes
bugs and extra w... continue reading
The CFG configuration format is a text format for configuration files which is similar
to, and a superset of, the JSON format.It has the following aims:
It overcomes a number of drawbacks of JSON when used as a configuration format:
Hi all,
I’d like your comments and feedback on an enhancement that introduces power assertions to the Python language.
This feature is inspired by a similar feature of the Groovy language[1], and is effectively a variant of the assert keyword.
When an assertion expression evaluates to False, the output shows not only the failure, but also a breakdown of the evaluated expression from the inner part to the outer part.
For example, a procedure like:
class SomeClass:
def \_\_init\_\_(self):
self.val = {'d': 'e'}
def \_\_str\_\_(self):
return str(self.val)
sc = SomeClass()
assert sc.val['d'] == 'f'
Will result in the output:
Assertion failed:
sc.val['d'] == f
\| \| \|
\| e False
\|
{'d': 'e'}
See link [2] if the formatting above is screwed up.
In the output above we can see the value of every part of the expression from left to right, mapped to their expres... continue reading
Over on Discuss, there's a small discussion about the "lambdas in for
loop" problem described in the FAQs.
https://discuss.python.org/t/make-lambdas-proper-closures/10553
I've created a poll on Discuss. If you have an account, you may like to
vote on whether for loops should run in their own scope:
https://discuss.python.org/t/should-loops-be-in-their-own-scope-poll/10593
No change, leave loops as they are.
Change loops to use their own scope.
No change for loops by default, but add an option to run them in a new scope.
Just throwing out some random syntax to be shot down, how does this read
to folks?
for item in sequence in scope:
# block here has its own scope
...
I have no idea what the implementation difficulties might be, but with
lots of hand-waving and in full knowledge that it won't be me having
to do the ... continue reading
Hi,
A bug has been identified and fixed in the OAuth-based
authentication code used on the Python bug tracker bugs.python.org
(BPO) to log in with GitHub, Launchpad or Google. Under some
conditions, it was possible to be logged as another person account. We
are only aware of a single user affected by the issue. We are not
aware of any account takeover.
All bugs at bugs.python.org are public: being logged as the wrong
account cannot give access to private bugs. The main risk is if an
attacker could be logged as an administrator (the "Coordinator" role)
which allows to change the bug tracker configuration and to change
accounts (add/remove roles, see/change the email address, etc.). We
are not aware of any abuse.
All OAuth accounts have been removed in the database to fully fix the
issue. Users using OAuth-based authentication must associate again
(once) their GitHub, Launchpad or Google account with their BPO
account.
A BPO account contains the following information: Name, Login N... continue reading
Hi!
I propose to enhance "itertools.compress" in such a way so if you don't provide selectors, then "data" itself is used as a selectors.
So "compress(a)" would be equivalent to "compress(a, a)"
For example:
from itertools import compress
[*compress([0, 1, 2, 3]))]
[1, 2, 3]
[*compress(["", "CFLAGS=-O3"])]
["CFLAGS=-O3"]
opts = compress([None, "", "-filove-python", "CFLAGS=-O3"])
" ".join(opts)
'-filove-python CFLAGS=-O3'
What do you think guys about this? Perhaps it was proposed by someone else?
Thanks!
Stepan Dyatkovskiy
Hi Folks,
Pythran, a compiler for scientific kernels written in Python, got a new release.
It contains a few changes detailed in the changelog[0] but I'd like to highlight
the work[1] of Xingyu Liu during her GSoC on improving pythran <-> scipy
integration. It's also a release that recieved a lot of external contributions,
and that's always a pleasure. Thanks to you all!
$ git log 0.9.9..0.10.0 | grep Author | sort -u | wc -l
21
As usual, Pythran is available since today on PyPI and github, and this will
propagate to conda, Fedora etc thanks to our beloved packagers!
[0] https://github.com/serge-sans-paille/pythran/blob/0.10.0/Changelog
[1] https://serge-sans-paille.github.io/pythran-stories/gsoc21-improve-performance-through-the-use-of-pythran.html
Over in https://github.com/python/typeshed/issues/6030 I have managed to
kick up a discussion over what exactly an "iterator" is. If you look at
https://docs.python.org/3/library/functions.html#iter you will see the docs
say it "Return[s] an iterator
https://docs.python.org/3/glossary.html#term-iterator object." Great, but
you go the glossary definition of "iterator" at
https://docs.python.org/3/glossary.html#term-iterator you will see it says
"[i]terators are required to have an __iter__()
https://docs.python.org/3/reference/datamodel.html#object.\_\_iter\_\_
method" which neither for nor iter() actually enforce.
Is there something to do here? Do we loosen the definition of "iterator" to
say they should define __iter__? Leave it as-is with an understanding
that we know that it's technically inaccurate for iter() but that we want
to encourage people to define __iter__? I'm assuming people don't want to
change for and iter() to start requiring __iter__ be ... continue reading
Hello all,
I sometimes write Python scripts which need to work in specific
work directories.
When putting such code into functions, the outer function typically
does not expect the current work dir (CWD) to be changed, so wrap the
code which need the (possibly) modified CWD using a simply context
manager along the lines of:
class workdir:
def __init__(self, dir):
self.dir = dir
def __enter__(self):
self.curdir = os.getcwd()
os.chdir(self.dir)
def __exit__(self, *exc):
os.chdir(self.curdir)
return False
Would there be interest in adding something like this to the os module
as os.workdir() ?
Example:
def backup_home_dir(account):
with os.workdir(os.path.join('/home', account)):
# Create a backup of the account dir, rooted at the account's
# home dir
restic.backup(repo, '.')
Notes:
When working with generators, AFAIK, there's currently no easy way to handle the case of an empty generator (which can be useful if such case is an error).
Converting the generator to a, say, list, is not a solution if the generator is intrinsically infinite.
I propose to have an "otherwise" clause in the "for" statement that runs only if no items are to be processed; that is, to have the following code:
for item in get_items():
SUITE1
otherwise:
SUITE2
be semantically equivalent to:
items_iter = iter(get_items())
try:
first_item = next(items_iter)
except StopIteration:
SUITE2
else:
for item in itertools.chain([first_item], items_iter):
SUITE1
I am trying to compile Python3.10rc2 on rather unusual platform (termux on
android). The
gcc version is listed below:
~ $ g++ -v
clang version 12.0.1
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
I get following warnings and errors:
Python/pytime.c:398:10: warning: implicit conversion from 'long' to
'double' changes value from 9223372036854775807 to 9223372036854775808
[-Wimplicit-const-int-float-conver
sion]
if (!_Py_InIntegralTypeRange(_PyTime_t, d)) {
Python/bootstrap_hash.c:141:17: error: implicit declaration of function
'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
n = getrandom(dest, n, flags);
^
Python/bootstrap_hash.c:145:17: error: implicit declaration of function
'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
n = getrandom(dest, n, flags);
Not sure if this is limitation of the platform or Python codebase needs
fixe... continue reading
I would love to make the 'subcommands' functionality provided in argparse more user-friendly.
I think I have a worthwhile feature request to share:
I've outlined an motivating example below, and shared an implementation of this feature that I've started using in one of my projects.
Thanks!
-Ryan
I am working with ArgumentParser subcommands a lot recently, and I've run into the interesting implementation detail when it comes to 'adding multiple subcommands to a parser': argparse.ArgumentParser provides a special 'action object' to manage subcommands.
Lets look at an example of how this works:
First, setup our root\_parser:
root\_parser = ArgumentParser()
Then, later on, lets add a 'post' subcommand:
action\_object = root\_parser.add\_subparsers()
post\_parser = action\_... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/G26ZM6QMITGEQ7NPH4YD4MFYGMCOH2VM/)
Hi,
I'm getting build errors on Windows for
https://github.com/python/cpython/pull/28386
The error message is:
C:\Program Files (x86)\Windows
Kits\10\Include\10.0.22000.0\um\winnt.h(253): error RC2188:
D:\a\cpython\cpython\PCbuild\obj\311win32_Release\pythoncore\RCa01688(47)
: fatal error RC1116: RC terminating after preprocessor errors
[D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]
Can anyone translate that into English for me?
It suggests that there are errors in the preprocessor. But how do I tell
what the error is?
Cheers,
Mark.
Hi all,
I have a weird case where I thought line events would be issued and yet
they aren't even though they're in the instructions in the bytecode (both
in 3.9 and 3.10).
i.e.:
Given the code:
def check_backtrack(x): # line 1
if not (x == 'a' # line 2
or x == 'c'): # line 3
pass # line 4
it has dis.dis such as:
2 0 LOAD_FAST 0 (x)
2 LOAD_CONST 1 ('a')
4 COMPARE_OP 2 (==)
6 POP_JUMP_IF_TRUE 12 (to 24)
3 8 LOAD_FAST 0 (x)
10 LOAD_CONST 2 ('c')
12 COMPARE_OP 2 (==)
2 14 POP_JUMP_IF_TRUE 10 (to 20)
4 16 LOAD_CONST 0 (None)
18 RETURN_VALUE
2 >> 20 LOAD_CONST 0 (None)
22 RETURN_VALUE
>> 24 LOAD_CONST 0 (None)
26 RETURN_VALUE
So, b... continue reading
Currently, math.factorial only supports integers and not floats, whereas the "mathematical" version supports both integers and floats.
I.e:
import math
def better\_factorial(n):
return n * math.gamma(n)
print(math.factorial(10) == better\_factorial(10))
This ends up in True, as that's correct.
However, math.factorial(math.pi) (for example, or any float)
Ends up in ValueError: factorial() only accepts integral values.
unlike better\_factorial(math.pi) which would end up in 7.188082728976031.
My proposal is to make another function for floats, or even use the same math.factorial function and check inside it whether the given input is an integer or a float object.
I would like to hear your review.
Jonathan.
https://discuss.python.org/t/how-do-we-want-to-manage-additions-removals-to-the-stdlib/10681
This comes from my language summit talk on the stdlib to help clarify some
things about how we manage the stdlib from the perspective of
additions/deletions.
FYI I will be muting this email thread immediately, so please participate
on discuss.python.org if you have anything to say (I almost didn't post
here, but I figured I would see if there's any chance people will follow
through on discuss.python.org if directed there and told feedback here will
be ignored).
NEW_FEATURE = "remove_barry_from_BDFL" or "barry_resign_as_FLUFL"/"barry_resign_as_BDFL";
Add a new future import NEW_FEATURE. This reverts the effects of the future import "barry_as_FLUFL" easter egg IF it is ever imported. This is absolutely unnecessary when "barry_as_FLUFL" isn't imported.
There can be optional messages attached to a Barry-related future import:
This idea also suggests allowing future imports anywhere in the file as long as it's Barry-related ( optional feature: only allow a Barry-related future import IF it is the opposite of the previous Barry-rela... continue reading
ACTIVITY SUMMARY (2021-09-10 - 2021-09-17)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7381 ( +5)
closed 49587 (+63)
total 56968 (+68)
Open issues with patches: 2938
#45170: tarfile missing cross-directory checking
https://bugs.python.org/issue45170 opened by xiongpanju
#45171: stacklevel handling in logging module is inconsistent
https://bugs.python.org/issue45171 opened by joukewitteveen
#45172: netbsd CAN protocol flags addition
https://bugs.python.org/issue45172 opened by devnexen
#45173: Remove configparser deprecations
https://bugs.python.org/issue45173 opened by hugovk
#45174: DragonflyBSD fix nis module build
https://bugs.python.org/issue45174 opened by devnexen
#45176: Many regtest failures on Windows with non-ASCII account name
https://bugs.python.org/issue45176 opened by ming... continue reading
Hi,
The recent optimization work on ceval.c and frame objects introduced
regressions and the situation is stuck for 4 months (bpo-43760).
Right now, maybe the best would be to revert the 2 commits in the 3.10
branch, to get more time in Python 3.11 development cycle to solve
these issues.
(1) "The DISPATCH() macro is not as efficient as it could be (move
PyThreadState.use_tracing)"
https://bugs.python.org/issue43760
This change introduced an incompatible C API change. It's not
documented in What's New in Python 3.10 and there is no solution for
the 4 broken projects (including Cython).
I proposed a C API but so far, nobody implemented it.
Another option is to fix each project since the list is short. Right
now, only 4 projects are known to be broken. Fixing Cython is not
enough, you need to get a new release of broken projects (using
Cython) to regenerate the C code with the updated Cython.
(2) "Performance regression 3.10b1 and later on Windows: Py_DECREF()
not inlined in P... continue reading
It would be very nice if the Synchronization Primitives had a timeout parameter just like the analogous classes do in the threading module.
Thank you for your consideration!
Hi,
I have started a project to move the parsing off-strings to the parser and
the grammar. Appart
from some maintenance improvements (we can drop a considerable amount of
hand-written code),
there are some interesting things we could (emphasis on could) get out
of this and I wanted
to discuss what people think about them.
f"blah blah {'\n'} blah"
File "<stdin>", line 1
f"blah blah {'\n'} blah"
^
SyntaxError: f-string expression part cannot include a backslash
f"some text { my_dict["string1"] } more text"
The parser will naturally allow more control over error messages and AST
positions.
The grammar of the f-string will be fully specified without
ambiguity. Currently, ... continue reading
Sorry for the double post, if the first one passed... I typed Enter too soon by accident :(
TL;DR: Add a strict keyword option to the dataclass constructor which, by default (True), would keep the current behavior, but otherwise (False) would generate an __init__ that accepts arbitrary **kwargs and that passes them to an eventual __post_init__.
Use case: I'm developing a client for a public API (that I don't control). I'd like this client to be well typed so my users don't have to constantly refer to the documentation for type information (or just to know which attributes exist in an object). So I turned to dataclasses (because they're fast and lead to super clean/clear code).
@dataclass
class Language:
iso_639_1: Optional[str]
name: Optional[str]
Then my endpoint can look like this
def get_language() -> Language:
result = requests.get(...)
return Language(**result.json)
That's fine but it poses a problem if the API, the one I have no control ove... continue reading
Dear Python community,
type hinting is awesome! But recently I stumbled upon the following:
I was writing a dictionary of functions that all share a common signature, in that the first two arguments were the same type.
However, the functions could differ in the remaining arguments (positional / keyword)
When trying to type hint as Callable[[int, float, ...], None] , which felt very natural at the time, mypy complained: error: Unexpected "...".
I propose to support type hints a la
which should match any callable with matching type hints for the first/last N inputs. (with some special treatment for functions with *args or **kwargs of course).
Best regard, Randolf.
Title is pretty self explanatory.
Right the following causes an error:
>>> ipaddress.IPv4Address('localhost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\ipaddress.py", line 1252, in \_\_init\_\_
self.\_ip = self.\_ip\_int\_from\_string(addr\_str)
File "C:\ProgramData\Anaconda3\lib\ipaddress.py", line 1144, in \_ip\_int\_from\_string
raise AddressValueError("Expected 4 octets in %r" % ip\_str)
ipaddress.AddressValueError: Expected 4 octets in 'localhost'
But it should just either convert localhost to 127.0.0.1 or maybe store localhost internally somehow.
I've recently released version 0.3.3 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.
The main changes in this release are as follows:
Fixed #152: Removed splituser() function which wasn't used and is deprecated.
Fixed #149: Handle version comparisons correctly in environment markers.
Add ARM-64 launchers and support code to use them. Thanks to Niyas Sait and
Adrian Vladu for their contributions.
Fixed #148: Handle a single trailing comma following a version. Thanks to Blazej
Floch for the report and suggested fix.
Fixed #150: Fix incorrect handling of epochs.
Reverted handling of tags for Python >= 3.10 (use 310 rather than 3_10). This is
because PEP 641 was rejected.
Added a GitHub Actions workflow to perform tests.
A more detailed change log is available at [2].
Please try it out, and if you find any problems or have any suggestions for im... continue reading
Where would be the best place to discuss or just improve the CPython docs
sphinx theme? What would Python need in a {PyData,} Sphinx theme fork:
[ ] ENH: add <edit on github> links to every docs page
[ ] ENH: responsive breakpoints for mobile devices
[ ] ENH: responsive fonts
[ ] ENH: toggle-able dark theme
[ ] ENH: interactive code examples (in WASM with pyodide like JupyterLite)
[ ] ENH?: Two sidebars: {Global TOC} {Content} {Document TOC}
The PyData theme [bandwagon, feature justification, maintenance burden
justification]
Src: https://github.com/pydata/pydata-sphinx-theme
Docs: https://pydata-sphinx-theme.readthedocs.io/en/latest/
Other sites that are using this theme:
- Pandas: https://pandas.pydata.org/docs/
- NumPy: https://numpy.org/doc/stable/
- SciPy: https://scipy.github.io/devdocs/
- NetworkX: https://networkx.org/documentation/latest/
- Bokeh: https://docs.bokeh.org/en/latest/
- JupyterHub and Binder: https://docs.mybinder.org/,
http://z2jh.jupy... [continue reading](https://mail.python.org/archives/list/python-ideas@python.org/thread/HIEEIJCY3WMBYVKDCE4BQDPRF5T5LX2B/)
Where would be the best place to discuss or just improve the CPython docs
sphinx theme? What would Python need in a {PyData,} Sphinx theme fork:
[ ] ENH: add <edit on github> links to every docs page
[ ] ENH: responsive breakpoints for mobile devices
[ ] ENH: responsive fonts
[ ] ENH: toggle-able dark theme
[ ] ENH: interactive code examples (in WASM with pyodide like JupyterLite)
[ ] ENH?: Two sidebars: {Global TOC} {Content} {Document TOC}
The PyData theme [bandwagon, feature justification, maintenance burden
justification]
Src: https://github.com/pydata/pydata-sphinx-theme
Docs: https://pydata-sphinx-theme.readthedocs.io/en/latest/
Other sites that are using this theme:
- Pandas: https://pandas.pydata.org/docs/
- NumPy: https://numpy.org/doc/stable/
- SciPy: https://scipy.github.io/devdocs/
- NetworkX: https://networkx.org/documentation/latest/
- Bokeh: https://docs.bokeh.org/en/latest/
- JupyterHub and Binder: https://docs.mybinder.org/,
http://z2jh.jupy... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/HIEEIJCY3WMBYVKDCE4BQDPRF5T5LX2B/)
FYI, I've just published the July steering council update, also included
below:
https://github.com/python/steering-council/blob/main/updates/2021-07-steering-council-update.md
Just as a reminder, if you have any questions or concerns, feel free to
contact us or open an issue in the SC repo:
https://github.com/python/steering-council
July 5
Dear python-dev,
I've been working on a port of cpython/Grammar/python.gram from C (as
currently used in all the {} expressions to build the AST) to Python, directly
building nodes via the ast package. My motivation for this (as opposed to
calling ast.parse, which uses the C parser) is to make it easy to experiment
with adding features to the syntax, without having to build CPython. Porting
is mostly straightforward, but it is a fair amount of work, because there are
a lot of expressions to port
My first question is whether anyone is working on this as well (or has
already done so and I missed it), to avoid duplication of effort.
Assuming not, my next question is where this belongs. Some natural options I
see:
Add it to cpython as a grammar maintained in parallel with the C grammar.
This would mean more maintenance when the grammar changes, but the plus side
is it guarantees that the two grammars (and ast) remain synchronized.
PyPy
3rd party library (e.g., m... continue reading
Hi All,
Following the discussions on "Power Assertions: Is it PEP-able?", I've drafted this PEP.
Your comments are most welcome.
PEP: 9999
Title: Power Assertion
Author: Noam Tenne noam@10ne.org
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 24-Sep-2021
This PEP introduces a language enhancement named "Power Assertion".
The Power Assertion is inspired by a similar feature found in the
Groovy language_ and is an extension to the core lib's assert
keyword.
When an assertion expression evaluates to False, the output shows
not only the failure, but also a breakdown of the evaluated expression
from the inner part to the outer part.
.. _Groovy language: http://docs.groovy-lang.org/next/html/documentation/core-testing-guide.html#\_power\_assertions
Every test boils down to the binary statement "Is this true or false?",
whether you use the built-in assert keyword or a more advanced
assertion method provided ... continue reading
This PR https://github.com/python/cpython/pull/28310 changes the message
for some exceptions.
Currently:
format('', '%M')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
With the proposed change:
format('', '%M')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier '%M' for object of type 'str'
This also applies to str.format() and f-strings.
This is clearly an improvement. My question is: is it okay to backport
this to 3.9 and 3.10? I think we have a rule that it's okay to change
the exception text, but I'm not sure how that applies to micro releases
(3.9.x, 3.10.1).
Eric
Hello,
first of all, thanks for working on variadic generics! I look forward to them.
My question: all the examples in https://www.python.org/dev/peps/pep-0646/ unpack into variadic arguments. But can I write code like this?
Ts = TypeVarTuple("Ts")
def enumerate\_args(f: Callable[[*Tuple[int, Ts]]], *args: *Ts):
f(*enumerate(args))
In particular I'm talking about the *Tuple[int, Ts] syntax. All the examples from the PEP use *Ts so I don't know if this is legal, but I hope so.
This should probably be clarified in the PEP.
--
Best regards,
Willi Schinmeyer
ACTIVITY SUMMARY (2021-09-17 - 2021-09-24)
Python tracker at https://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.
Issues counts and deltas:
open 7333 (-48)
closed 49684 (+97)
total 57017 (+49)
Open issues with patches: 2907
#34451: docs: tutorial/introduction doesn't mention toggle of prompts
https://bugs.python.org/issue34451 reopened by rhettinger
#45237: Python subprocess not honoring append mode for stdout on Windo
https://bugs.python.org/issue45237 opened by wolfgang-kuehn
#45239: email.utils.parsedate_tz raises UnboundLocalError if time has
https://bugs.python.org/issue45239 opened by benhoyt
#45240: Add +REPORT_NDIFF option to pdb tests that use doctest
https://bugs.python.org/issue45240 opened by andrei.avk
#45242: test_pdb fails
https://bugs.python.org/issue45242 opened by oliphaunt
#45243: [sqlite3] add support for changing connec... continue reading
Irit, Guido, Yuri, Nathaniel,
(In the interest of visibility, this was also posted to discuss.python.org
https://discuss.python.org/t/accepting-pep-654-exception-groups-and-except/10813
.)
After careful consideration and rather lengthy discussion, the Steering
Council has decided to accept PEP 654 (Exception Groups and except*)
https://www.python.org/dev/peps/pep-0654/. We do have two requests, one
of which we mentioned before. We’re very pleased with the amount of care
and discussion that went into this PEP, and we’re satisfied that it solves
a real-world problem in the least disruptive way. We do remain open for
further tweaking of the design, incorporating some of Nathaniel’s ideas, or
new ones, but we want to move forward with PEP 654’s proposal and let
people get hands-on experience with it. To that end, our request is that we
get at least one non-toy use of ExceptionGroups somewhere in the standard
library (targeted to 3.11, like PEP 654), and preferably get some
third-part... continue reading
As last year, we are holding the General Assembly (GA) of the EuroPython
Society (EPS) online for this year.
In accordance with our bylaws, we are calling for the EuroPython Society
General Assembly to be held on Sunday, October 10th 2020, from 19:00 -
21:00 CEST. We will use a Zoom meeting to hold the event and send around
the URL closer to the event.
All EPS members are welcome to join and vote at the meeting. Please be
aware that we cannot allow non-EPS members to join, as we often do at
the in-person GAs we hold at the conference, since we would then not be
able to control access to the Zoom call.
As every year, we will vote in a new board. We have already sent out the
list of board nominations in a separate blog post on 2021-09-23. Please
see that post for details on the candidates and the nomination process.
EuroPython Society Members can propose motions to b... continue reading
PyEmpaq is a simple but powerful Python packer to run any project with
any virtualenv dependencies anywhere.
With PyEmpaq you can convert any Python project into a single .pyz
file with all the project's content packed inside.
That single file is everything that needs to be distributed. When the
final user executes it, the original project will be expanded, its
dependencies installed in a virtualenv, and then executed. Note that
no special permissions or privileges are required, as everything
happens in the user environment.
Both the packaging and the execution are fully multiplatorm. This
means that you can pack a project in Linux, Windows, Mac or whatever,
and it will run ok in Linux, Windows, Mac or whatever.
This version brings the following change:
PyEmpaq can be installed directly from PyPI:
pip install --user --upgrade --ignore-installed pyempaq
If you have fades you don't even need to install py... continue reading
Dear Python Community,
We hope that you are all well to that end and that you have been busy
working on various awesome Python Projects. It's that time of the year
folks and we would like to engage the community for another conference and
workshops during the first week of December 2021.
PyCon Tanzania, is seeking speakers of all experience levels and
backgrounds to contribute to the Python Conference program! If you use the
Python programming language professionally, as a hobbyist or are just
excited about Python or programming and open source communities, we'd love
to hear from you. We want you and your ideas at the upcoming Python
Conference!
We are looking for presenters who would:
- Offer a technical tutorial on an appropriate topic;
- Participate in the technical conference sessions as a speaker;
- Convene and chair panel sessions of relevant topics.
Topics must be relevant to the Python Language and Open Source Software:
I’m getting increasingly worried about the future of Python, and those worries have been exacerbated by the new yearly release rhythm, and the lack of a stable C-API that is full enough to entice extension writers to use it.
PyPI packages and wheels are targeted to specific Python versions, which means that any project that depends on some of the larger extension packages (of which there are many, and many of which are must-have for many projects) now start lagging Python versions by years, because somewhere deep down in the dependency graph there is something that is still stuck at Python 3.8 (for example). I fully understand that 3.8 is good enough for the developers of that package, and that they have more pressing things to do than porting to 3.9 or 3.10, but it now keeps any project or package that depends on their software on 3.8 as well.
And I also fully understand that some other developer who creates a new package that is essential to my application only targets the current ... continue reading
Leo http://leoeditor.com 6.4 is now available on
GitHub.
Leo is an IDE, outliner and PIM.
The highlights of Leo 6.4
Links
We’re happy to release the first 42 cut videos of EuroPython 2021
covering the first day sessions of the conference. You can watch them on
our YouTube channel:
* EuroPython 2021 Playlist *
https://www.youtube.com/playlist?list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW
Over the next few weeks, we’ll continue releasing the videos for the
second and third day of the conference. In total, we will have more than
115 videos with lots of valuable and interesting content for you, so
please stop by and check the playlist for more videos, or subscribe to
our YouTube channel.
http://europython.tv/
Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !
Link to the blog post:
https://blog.europython.eu/europython-2021-edited-videos-of-the-first-day-available/
Tweet:
https://twitter.com/europython/status/1442493825491025924
EuroPython 2021 Team
https://ep2021.europyt... continue reading
We've frozen most of the stdlib modules imported during "python -c
pass" [1][2], to make startup a bit faster. Import of those modules
is controlled by "-X frozen_modules=[on|off]". Currently it defaults
to "off" but we'd like to default to "on". The blocker is the impact
on contributors. I expect many will make changes to a stdlib module
and then puzzle over why those changes aren't getting used. That's an
annoyance we can avoid, which is the point of this thread.
Possible solutions:
Thoughts?
-eric
[1] https://bugs.python.org/issue45020
[2] FWIW, we may end up also freezing the modules imported for "python
-m ...", along with some other commonly used modules (like argparse).
That is a separate discussion.
Hi,
I would like to change the Python C API. I failed to write a single
document listing all constraints and proposing all changes that I
would to do. For example, my previous PEP 620 contains too many
changes and is too long.
Here is my attempt to focus on the bare minimum and (what I consider
as) the least controversial part: list current usages of C API and
constraints of these usages. This informal PEP should be the base of
future PEP changing the C API.
The current draft lives at:
https://github.com/vstinner/misc/blob/main/cpython/pep-c-api-next-level.rst
My PEP is based on HPy Next Level Manifesto written by Simon Cross:
https://github.com/hpyproject/hpy/wiki/c-api-next-level-manifesto
To reach most users of the C API, I cross-posted this email to
python-dev, capi-sig and hpy-dev.
+++++++++++++++++++++++++++++++++++++++++
Taking the Python C API to the Next Level
+++++++++++++++++++++++++++++++++++++++++
::
PEP: xxx
Title: Taking the Python C API to the Next Le... [continue reading](https://mail.python.org/archives/list/python-dev@python.org/thread/RA7Q4JAUEITJBOUAXFEJKRRM2RR3QSZI/)
Hi,
As it seems that I didn't have enough work dealing with the multiple
release blockers that have been raised these weeks I am also preparing a
Python 3.10 release party.
We will be doing an stream, co-hosted by the good people of Python discord
channel. The URL for the stream is this one:
The release party will start on October 4th at 17:00 UTC+0.
In this stream, some core developers (Irit, Carol, Brandt and Łukasz) will
be talking about Python 3.10 features and some sneak peak on Python 3.11
and beyond, talking about the core Dev in residence role and other things
with some time for moderated Q&A. I will be doing the release live and will
also cover what I am doing. Is a fantastic opportunity to watch me make
mistakes live :)
The main purpose of the stream is to raise excitement about Python 3.10,
explain the new features to users, trying to get the community closer to
the core Dev team and allowing them to meet some of the new core Devs
(Brandt a... continue reading
Greetings folks,
FlaskCon is around again this year, the very latest conf of the year.
Bouncing in the first week of December, 1 2 3 4.
CFP is open, submit -> https://flaskcon.com/
Any queries, let them fly to flaskcon@gmail.com
Kind Regards,
Abdur-Rahmaan Janhangeer
about https://compileralchemy.github.io/ | blog
https://www.pythonkitchen.com
github https://github.com/Abdur-RahmaanJ
Mauritius
Lambda functions that have a single parameter are a common thing, e.g. for "key" functions: sorted(items, key=lambda x: x['key']). For these cases however, the rather long word "lambda" together with the repetition of the parameter name, results in more overhead than actual content (the x['key']) and thus makes it more difficult to read. This is also a difficulty for map and filter for example where there's lots of visual overhead when using a lambda function and hence it's difficult to read: filter(lambda x: x > 0, items) or map(lambda x: f'{x:.3f}', items).
Hence the proposal is to add a new syntax via the new token ?. For the examples above:
sorted(items, key=?['key'])filter(? > 0, items)map(f'{?:.3f}', items)The rules are simple: whenever the token ? is encountered as part of an expression (at a position where a name/identifier would be legal), the expression is replaced by a lambda function with a single parameter which has that expression as a re... continue reading
I am pleased to announce the release of SfePy 2021.3.
SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by finite element methods. It is
distributed under the new BSD license.
Home page: https://sfepy.org
Mailing list: https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
Git (source) repository, issue tracker: https://github.com/sfepy/sfepy
For full release notes see [1].
Cheers,
Robert Cimrman
[1] http://docs.sfepy.org/doc/release\_notes.html#id1
Contributors to this release in alphabetical order:
Robert Cimrman
Hugo Levy
Vladimir Lukes
Wing 8.0.4 adds Close Unmodified Others to the editor tab's context
menu, documents using sitecustomize to automatically start debug, fixes
the debugger on some Windows systems, improves icon rendering with some
Windows scaling factors, and makes several other improvements.
Details: https://wingware.com/news/2021-09-28
Downloads: https://wingware.com/downloads
== About Wing ==
Wing is a light-weight but full-featured Python IDE designed
specifically for Python, with powerful editing, code inspection,
testing, and debugging capabilities. Wing's deep code analysis provides
auto-completion, auto-editing, and refactoring that speed up
development. Its top notch debugger works with any Python code, locally
or on a remote host, container, or cluster. Wing also supports
test-driven development, version control, UI color and layout
customization, and includes extensive documentation and support.
Wing is available in three product levels: Wing Pro is... continue reading
So uh, this is a hardly at all fleshed out idea, but one thing we really
don't like about python is having to do stuff like this so as to not
swallow exceptions:
def a_potentially_recursive_function(some, args):
"""
Does stuff and things.
Raises ExceptionWeCareAbout under so and so conditions.
"""
try: some.user_code() except ExceptionWeCareAbout as exc: raise
RuntimeError from exc
code_we_assume_is_safe()
if args.something and some_condition:
raise ExceptionWeCareAbout
It'd be nice if there was a way to... make this easier to deal with.
Perhaps something where, something like this:
def a_potentially_recursive_function(some, args) with ExceptionWeCareAbout:
"""
Does stuff and things.
Raises ExceptionWeCareAbout under so and so conditions.
"""
some.user_code()
code_we_assume_is_safe()
if args.something and some_condition:
raise ExceptionWeCareAbout
becomes:
def a_potentially_recursive_function(so... continue reading
PyCA cryptography 35.0.0 has been released to PyPI. cryptography
includes both high level recipes and low level interfaces to common
cryptographic algorithms such as symmetric ciphers, asymmetric
algorithms, message digests, X509, key derivation functions, and much
more.
We support Python 3.6+, and PyPy3.
Changelog (https://cryptography.io/en/latest/changelog/#v35-0-0):
Is an implementation of Python free to make up its own answers to
division and modulus operatons in the case of inf and nan arguments?
The standard library documentation says only that // is "rounded towards
minus infinity". The language reference says that ||:
It's consistent, but it doesn't define the operator over the full range
of potential arguments. In Python 3.8 and 3.9:
from decimal import Decimal
Decimal('-3.14') // Decimal('Infinity')
Decimal('-0')
-3.14 // float("inf")
-1.0
import math
math.floor(-3.14 / float("inf"))
0
I can see sense in all three answers, as possible interpretations of
"rounded towards minus infinity", but I quite like decimal's. There seem
to be no regression tests for floor division of floats, and for modulus
only with finite arguments, perhaps inten... continue reading
We are making our debut on this mailing list with a release that fixes
a security
vulnerability https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3828.
This release is intended to be a drop-in replacement. It contains the
following changes:
Thanks to the following contributors to 3.6.4:
Tom Aarsen, Mohaned Mashaly, Dimitri Papadopoulos Orfanos, purificant,
Danny Sepler
What is NLTK?
The acronym stands for "Natural Language ToolKit". NLTK is educational
software for those interested in natural language processing, though some
have also incorporated it into commercial applications (and its License
supports this). A key use case is proces... continue reading
In the spirit of 3.9 allowing builtin collections like list, dict,
tuple, and set to be subscripted for type-hinting to remove the need
for importing their equivalents from typing, I'd like to propose the same
thing for a few other builtin objects, namely:
type (for use instead oftyping.Type)
any (for use instead of typing.Any)
callable (for use instead of typing.Callable)
(I'm aware that a better syntax for type-hinting callables using
arrow-syntax is potentially currently in the works, so maybe this last one
can be ignored)
Having to explicitly import objects from typing for basic type-hinting
use-cases is a not-inconsiderable source of frustration preventing their
uptake, especially by beginners. 3.9 made a valuable step forward in
reducing this friction, but I think we can go further.