Performance project for the SigEx Foundry
have been testing performances of different scripting languages fordatabase access, text processing and client application data transfer. So far, I am getting better performance from PHP, but I don't have any hard data to back it up compared to others. This is a large project for the SigEx Foundry and it involves hundreds of servers. I am looking for articles/studies/benchmarks on the subject. Thank you, Pablo Server Side Developer Student for the SigEx Foundry funded by SigEx Ventures -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance project for the SigEx Foundry
On Feb 22, 8:40 pm, [EMAIL PROTECTED] wrote: > On Feb 21, 1:15 pm, [EMAIL PROTECTED] wrote: > > > have been testing performances of different scripting languages > > fordatabase access, text processing and client application data > > transfer. So far, I am getting better performance from PHP, but I > > don't have any hard data to back it up compared to others. > > > This is a large project for theSigExFoundryand it involves hundreds > > of servers. I am looking for articles/studies/benchmarks on the > > subject. > > > Thank you, > > > Pablo > > Server Side Developer > > Student for theSigExFoundry, > > bySigExVentures > > Hi Pablo, > > It's a good question. You want to really understand what you are doing > this benchmark for. In my opinion, you should go for the language that > fits your needs and focus on performance optimization for that > language. I would be more inclined to go with PHP, but that's a > personal choice. I'm sure you can search performance for these > languages and come up with lots of ressources on the web. > > Pierre-Marie Durand Pierre-Marie, Thanks for the feedback. You are right, for now, I am sticking to PHP, but I would like to read more about this subject. Bearophile's link is a good start. Thanks, Pablo Server Side Developer Student for the SigEx Foundry, SigEx Ventures -- http://mail.python.org/mailman/listinfo/python-list
Use of lambda functions in OOP, any alternative?
Hello all, sorry if this is a faq... Problem: The intended effect is to override the method 'getattr' in a way that i dont need to override the property explicitly too. class Base(object): def __init__(self, attr): self._attr = attr def getattr(self): return self._attr attr = property(fget=getattr) class Derived(Base): def getattr(self): return 2*self._attr if __name__ == "__main__": b = Base(4) d = Derived(4) print b.attr, d.attr output>> 4 8 ... so this does not work as i would like it to. First solution: This is not what i want. class Derived(Base): def getattr(self): return 2*self._attr attr = property(fget=getattr) Second solution: This is what i want, but... class Base(object): def __init__(self, attr): self._attr = attr def getattr(self): return self._attr attr = property(fget=lambda self: self.getattr()) class Derived(Base): def getattr(self): return 2*self._attr Question: Isn't there an *alternative* way to do it without the lambda function? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
Re: Use of lambda functions in OOP, any alternative?
Pablo ha escrito: > Hello all, sorry if this is a faq... > > Problem: The intended effect is to override the method 'getattr' in a > way that i dont need to override the property explicitly too. > > class Base(object): > def __init__(self, attr): > self._attr = attr > def getattr(self): > return self._attr > attr = property(fget=getattr) > > class Derived(Base): > def getattr(self): > return 2*self._attr > > if __name__ == "__main__": > b = Base(4) > d = Derived(4) > print b.attr, d.attr > > output>> 4 8 ... so this does not work as i would like it to. sorry, i meant the following sentence: output>> 4 4 ... so this does not work as i would like it to. > > First solution: This is not what i want. > > class Derived(Base): > def getattr(self): > return 2*self._attr > attr = property(fget=getattr) > > Second solution: This is what i want, but... > > class Base(object): > def __init__(self, attr): > self._attr = attr > def getattr(self): > return self._attr > attr = property(fget=lambda self: self.getattr()) > > class Derived(Base): > def getattr(self): > return 2*self._attr > > Question: Isn't there an *alternative* way to do it without the lambda > function? > > Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
Re: Use of lambda functions in OOP, any alternative?
The reason i would like a different approach to the lambda function is just a question of personal taste... i dont really like it. thanx! -- http://mail.python.org/mailman/listinfo/python-list
Re: Use of lambda functions in OOP, any alternative?
Oh! Thanx! Great! this is what i was looking for! :) Scott David Daniels ha escrito: > Pablo wrote: > > > Second solution: This is what i want, but... > > > > class Base(object): > > def __init__(self, attr): > > self._attr = attr > > def getattr(self): > > return self._attr > > attr = property(fget=lambda self: self.getattr()) > > > > class Derived(Base): > > def getattr(self): > > return 2*self._attr > > > > Question: Isn't there an *alternative* way to do it without the lambda > > function? > > > > Thanks in advance! > > Simplest: > > class Base(object): > def __init__(self, attr): > self._attr = attr > def getattr(self): > return self._attr > @property # single-arg property is a read-only thing. > def attr(self): > return self.getattr() > > ### Little longer; maybe more explicit (tastes vary): > > class Base(object): > def __init__(self, attr): > self._attr = attr > def getattr(self): > return self._attr > def attr(self): > return self.getattr() > attr = property(fget=attr) > > > --Scott David Daniels > [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
python help
> > Hi I'm tryin to create a game but I have a question in how to save > > (saveasfile) the value of a global variable.. and then load the same value > > with openfile. > > Also for example you have a main label and a botton on the left so when > > you click the left bottom the label will change or refresh to another label, > > and when you return to the original label show or refresh to the original > > one. All the works is with matrix in python 3.2 and also tkinter. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found
How about using the second usage of builtin iter()?
In [92]: iter?
Docstring:
iter(iterable) -> iterator
iter(callable, sentinel) -> iterator
Get an iterator from an object. In the first form, the argument must
supply its own iterator, or be a sequence.
*In the second form, the callable is called until it returns the sentinel.
<<<-this one <<<---*
Type: builtin_function_or_method
In [88]: numbers
Out[88]: [1, 9, 8, 11, 22, 4, 0, 3, 5, 6]
# create iterator over the numbers to make callable simple
# you may pre-sort or do w/e as needed of course
In [89]: numbers_it = iter(numbers)
# callable passed into iter - you may customize this
# using functools.partial if need to add function arguments
In [90]: def grab_until():
...: return next(numbers_it)
...:
# here 0 is the 'sentinel' ('int()' would work as well as you have
# the iterator produced by iter() here stops as soon as sentinel value
# is encountered
In [91]: list(iter(grab_until, 0))
Out[91]: [1, 9, 8, 11, 22, 4]
Hope this helps
Pablo
On Sat, Jan 7, 2017 at 8:38 AM, Jussi Piitulainen <
[email protected]> wrote:
> Rustom Mody writes:
> > On a Saturday, Jussi Piitulainen wrote:
>
> [snip]
>
> >> You switched to a simpler operator. Would Haskell notice that
> >>
> >>def minabs(x, y): return min(x, y, key = abs)
> >>
> >> has a meaningful zero? Surely it has its limits somewhere and then
> >> the programmer needs to supply the information.
> >
> > Over ℕ multiply has 1 identity and 0 absorbent
> > min has ∞ as identity and 0 as absorbent
> > If you allow for ∞ they are quite the same
>
> There is nothing like ∞ in Python ints. Floats would have one, but we
> can leave empty minimum undefined instead. No worries.
>
> > Below I am pretending that 100 = ∞
>
> Quite silly but fortunately not really relevant.
>
> > Here are two lazy functions:
> > mul.0.y = 0 -- Lazy in y ie y not evaluated
> > mul.x.y = x*y
> >
> > minm.0.y = 0 -- likewise lazy in y
> > minm.x.y = min.x.y
>
> Now I don't see any reason to avoid the actual function that's been the
> example in this thread:
>
> minabs.0.y = 0
> minabs.x.y = x if abs.x <= abs.y else y
>
> And now I see where the desired behaviour comes from in Haskell. The
> absorbing clause is redundant, apart from providing the specific
> stopping condition explicitly.
>
> > Now at the interpreter:
> > ? foldr.minm . 100.[1,2,3,4]
> > 1 : Int
> > ? foldr.minm . 100.[1,2,3,4,0]
> > 0 : Int
> > ? foldr.minm . 100.([1,2,3,4,0]++[1...])
> > 0 : Int
> >
> > The last expression appended [1,2,3,4,0] to the infinite list of numbers.
> >
> > More succinctly:
> > ? foldr.minm . 100.([1,2,3,4,0]++undefined)
> > 0 : Int
> >
> > Both these are extremal examples of what Peter is asking for — avoiding
> an
> > expensive computation
>
> Ok. Thanks.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
*Pablo Lucena*
--
https://mail.python.org/mailman/listinfo/python-list
Re: distribute python interpreter and dependencies
After changing PATH variable; are you ensuring that the failed hosts are using the new PATH vs the old one? I've seen different behavior on different Windows versions for what it takes to "refresh" the env. System vs User defined env may also affect this, depending on the user invoking your program (windows versions have different behaviors from my experience) Also may depend on 32 vs 64 bit? But sounds like this isn't the issue. Also seen issues related to having the same Visual Studio files on client machines as was used to compile the version of python your distributing. Just a few thoughts. On Mon, Nov 12, 2018 at 4:11 PM Thomas Jollans wrote: > On 12/11/2018 17:40, Juan Cristóbal Quesada wrote: > > Hello, > > this is my first mail. I resorted to the list after some prior > struggling. > > Welcome! > > > Im facing the need to distribute a python installation folder and > > interpreter in a shared network drive. > > > > Im also distributing the application's source code that would lie also in > > another network drive. > > > > For this, my attempts have gone towards replicating the python > installation > > folder created after installing python27 in one machine and copy all the > > files and directories to the network drive. After that, copied the > > python27.dll of the C:/Windows/System32 file and set all the > > Python27/lib;Python27/DLLs/Python27/Scripts... to the PATH > environment > > variable through a launcher script. > > I assume you have a good reason to want to use an old version of Python... > > > > > This works on my machine and a couple othersBUT, not in some other > > machines running as well windows 10 pro. > > In what way does it not work? Is there an error message? > > > So i investigated a bit and > > discovered that if i install the python27 (2.7.11 same version) in one of > > those failing machines... the "ctypes.pyd" module's filesize is > > different So i replaced the original python27 folders with those of > the > > new installed python and now it works on those machines..havent > > tried yet if it still works on the first ones... > > > > Why is this behaviour? Im guessing the python27 installer generates some > > dlls "on the fly" that are tied to the windows operating > system... > > > > I dont want to create a windows executable via py2exe or > > pyinstaller.. What are the best steps to make a python > interpreter > > available to all windows based different machines? Am i missing something > > else? What are the steps the python windows installer performs in order? > > I have no idea what the Python.org installer is doing here, but you > could try one of the other Python distributions (e.g. miniconda)... > MAYBE you'll have more luck with that (Or ActivePython, or WinPython, or > whatever). > > > -- Thomas > -- > https://mail.python.org/mailman/listinfo/python-list > -- *Pablo Lucena* -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting file extensions [linux fs]
Have you looked into eBPF? They have mature Python bindings. It makes interacting with the kernel as efficient as possible - you can run it in production at high resolutions without putting things at risk. One of the benefits - any averaging / aggregation / histograms / etc can be done by the kernel within the eBPF runtime, then passed back to python using eBPF "maps" - the link between your userspace program and the eBPF kernel code. From python this "map" is just a dict. You'll need to be running at least kernel version 4.4 to get the basic functionality, but ideally 4.9 or higher for all the newer and stable features. No dependencies, its baked into the kernel. You will need clang support to compile stuff, if you want to build modules on your own. *Pablo Lucena* On Sat, Mar 30, 2019 at 8:30 PM Paulo da Silva < [email protected]> wrote: > Às 22:18 de 28/03/19, Cameron Simpson escreveu: > > On 28Mar2019 01:12, Paulo da Silva > wrote: > >> Às 23:09 de 27/03/19, Cameron Simpson escreveu: > ... > > > > > Oh, just tangential to this. > > > > If you were doing this ad hoc, yes calling the filefrag executable is > > very expensive. But if you are always doing a large batch of filenames > > invoking: > > > > filefrag lots of filenames here ...> > > and reading from its output can be very effective, because the expense > > of the executable is amortized over all the files - the per file cost is > > much reduced. And it saves you working out how to use the ioctls from > > Python :-) > That's not the case. > I need to do it on some files basis which I don't know in advance. > Using IOCTL, I don't need to parse or unpack the output. Only compare > the output arrays. Besides I need to store many of the outputs. Doing > that from filefrag text output would be unpractical. I needed, at least, > to compress the data. Although may be I might have to compress the ioctl > arrays ... Let's see how big in average is the storage needed. > > I have to go with ioctl. I have to open the files anyway, so there is no > overhead for that when calling the ioctl. > > Anyway, thank you for the suggestion. > > Regards. > Paulo > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] asyncio: return from multiple coroutines
Thank you very much Kyle for your answer, I am moving this conversation to
the more proper python-list for whoever wants to chime in. I summarize here
the key points of my original question (full question on the quoted email):
I have an application that listens on two websockets through the async
library https://websockets.readthedocs.io/ and I have to perform the same
function on the result, no matter where the message came from. I have
implemented a rather cumbersome solution with async Queues:
https://pastebin.com/BzaxRbtF, but i think there has to be a more
async-friendly option I am missing.
Now I move on to the comments that Kyle made
On Tue, Jun 23, 2020 at 12:32 AM Kyle Stanley wrote:
> I believe asyncio.wait() with "return_when=FIRST_COMPLETED" would
> perform the functionality you're looking for with the
> "asyncio.on_first_return()". For details on the functionality of
> asyncio.wait(), see
> https://docs.python.org/3/library/asyncio-task.html#asyncio.wait.
>
> I understand that I can create two coroutines that call the same
> function, but it would be much cleaner (because of implementation issues)
> if I can simply create a coroutine that yields the result of whichever
> connection arrives first.
>
> You can use an asynchronous generator that will continuously yield the
> result of the first recv() that finishes (I'm assuming you mean
> "yields" literally and want multiple results from a generator, but I
> might be misinterpreting that part).
>
Yes, I want to have multiple results: the connections listening forever,
returning a result for each message received.
>
> Here's a brief example, using the recv() coroutine function from the
> pastebin linked:
>
> ```
> import asyncio
> import random
>
> async def recv(message: str, max_sleep: int):
> sleep_time = max_sleep * random.random()
> await asyncio.sleep(sleep_time)
> return f'{message} awaited for {sleep_time:.2f}s'
>
> async def _start():
> while True:
> msgs = [
> asyncio.create_task(recv("Messager 1", max_sleep=1)),
> asyncio.create_task(recv("Messager 2", max_sleep=1))
> ]
> done, _ = await asyncio.wait(msgs,
> return_when=asyncio.FIRST_COMPLETED)
> result = done.pop()
> yield await result
>
> async def main():
> async for result in _start():
> print(result)
>
> asyncio.run(main())
> ```
I forgot to mention thatI did try to use asyncio.wait with
`FIRST_COMPLETED`; however, the problem is that it seems to evict the
not-completed coroutines, so the messenger that arrives second does not
send the message. To check it, I have run that script without the random
sleep. just msgr1 waits 1s and msgr2 waits 2s, so msgr1 always ends first.
I expect a result like this (which I am currently getting with queues):
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
Messenger 2 waits for 2.0s
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
Messenger 2 waits for 2.0s
Messenger 1 waits for 1.0s
...
but instead I got this:
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
Messenger 1 waits for 1.0s
...
> Note that in the above example, in "msgs", you can technically pass
> the coroutine objects directly to asyncio.wait(), as they will be
> implicitly converted to tasks. However, we decided to deprecate that
> functionality in Python 3.8 since it can be rather confusing. So
> creating and passing the tasks is a better practice.
>
Thanks for that info, I am still trying to grasp the best practices
surrounding mostly the explicitness in async.
> > Again, it's quite likely I am not seeing something obvious, but I didn't
> know where else to ask.
>
> If you're not mostly certain or relatively inexperienced with the
> specific area that the question pertains to, I'd recommend asking on
> python-list first (or another Python user community). python-ideas is
> primarily intended for new feature proposals/suggestions. Although if
> you've tried other resources and haven't found an answer, it's
> perfectly fine to ask a question as part of the suggestion post.
>
>
>
Original question, as posted in python-ideas:
> On Mon, Jun 22, 2020 at 6:24 PM Pablo Alcain
> wrote:
> >
> > Hey everyone. I have been looking into asyncio lately, and even though I
> have had my fair share of work, I still have some of it very shaky, so
> first of all forgive me if what I am saying here is already implemented and
> I totally missed it (so far, it looks *really* likely).
> >
> > Basically this is the situation: I have an application that
https://www.python.org/downloads/ offline
Is anyone else getting 503 errors when accessing the downloads page of python.org? -- *Pablo Lucena* -- https://mail.python.org/mailman/listinfo/python-list
Problem with 'print'
Hello, recently I downloaded python, but when I try to execute one file with the command 'print' it shows me a error. The error is: Missing parentheses in call to 'print' Please help mThank you. -- https://mail.python.org/mailman/listinfo/python-list
Cycling through iterables diagonally
Hello, I am trying to accomplish the following: Say I have a group of 4 lists as follows: l1 = ['a1', 'a2', 'a3', 'a4'] l2 = ['b1', 'b2', 'b3', 'b4'] l3 = ['c1', 'c2', 'c3', 'c4'] l4 = ['d1', 'd2', 'd3', 'd4'] I would like to cycle through these lists "diagonally" in groups of len(list) (in this example, each list has 4 items). cycle1: a1, b2, b3, b4 cycle2: a2, b3, c4, d1 cycle3: a3, b4, c1, d2 cycle4: a4, b1, c2, d3 The way I thought about doing this is as follows: from collections import deque from itertools import cycle l1 = deque(['a1', 'a2', 'a3', 'a4']) l2 = deque(['b1', 'b2', 'b3', 'b4']) l3 = deque(['c1', 'c2', 'c3', 'c4']) l4 = deque(['d1', 'd2', 'd3', 'd4']) l1.rotate(-0) l2.rotate(-1) l3.rotate(-2) l4.rotate(-3) groups = cycle([l1, l2, l3, l4]) In [115]: for group in groups: .: if not group: .: break .: print(group.popleft()) .: a1 b2 c3 d4 a2 b3 c4 d1 a3 b4 c1 d2 a4 b1 c2 d3 Prior to this I was mucking around with index counting while looping, and popping lists out of a deque, popping an item out of the list, and appending the list back into the deque during each iteration. Is there a better/cleaner way to do this? I was hoping for some cool itertools logic =) Thanks! -- *Pablo* -- https://mail.python.org/mailman/listinfo/python-list
Re: Python write to spreadsheet?
Try openpyxl - I've found this to be a really nice library for interacting with MS Excel. On Sat, May 30, 2015 at 5:30 AM, Justin Thyme wrote: > Is it possible to write a Python program that will start MS Excel, create > a spreadsheet and fill cells A1 to A10 (say) with the data in a Python > array? The answer is surely yes, but is there an outline of how to do it > somewhere? > -- > Shall we only threaten and be angry for an hour? > When the storm is ended shall we find > How softly but how swiftly they have sidled back to power > By the favour and contrivance of their kind? > > From /Mesopotamia/ by Rudyard Kipling > -- > https://mail.python.org/mailman/listinfo/python-list > -- *Pablo Lucena* -- https://mail.python.org/mailman/listinfo/python-list
Re: convert output to list(and nested dictionary)
2)
> source: [0.0.0.0/0]
>
> SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
> IPPermissions:tcp(22-22) source: [10.0.20.100/32]
>
> SecurityGroup:launch-wizard-2 sg-932255f6 inbound:
> IPPermissions:tcp(443-443) source: [0.0.0.0/0]
>
> >>>
>
>
> Here is the output i am looking for
>
>
> rule1 = [{
>
> 'cidr': '67.184.225.222/32',
>
> 'proto': 'tcp',
>
> 'port': 80
>
> },{
>
> 'cidr': '67.184.225.222/32',
>
> 'proto': 'tcp',
>
> 'port': 5500
>
> }]
>
>
> rule2 = [{
>
> 'cidr': '[0.0.0.0/0',
>
> 'proto': 'tcp',
>
> 'port': 80
>
> }]
>
>
> rule3 = [{
>
> 'cidr': '0.0.0.0/0',
>
> 'proto': 'tcp',
>
> 'port': 22
>
> },{
>
> 'cidr': '0.0.0.0/0',
>
> 'proto': 'tcp',
>
> 'port': 80
>
> }]
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
--
*Pablo Lucena*
--
https://mail.python.org/mailman/listinfo/python-list
Re: help in pexpect multiprocessing
I think the problem is that you cannot pass around an open socket via
pickle. Whats the error message you are getting?
Try adding the session establishment code to the stop function, so that
each new process opens a session to the server and executes the command.
def stop(ds):
s = pxssh.pxssh()
s.login ('host','username','password')
s.sendline ('ps -ef|grep java')
s.prompt(timeout=1)
s.sendline ('cd /usr')
if condition:
lock = threading.Lock()
lock.acquire()
s.expect('Enter username:')
s.sendline ('user')
s.expect('Enter password:*')
s.sendline('pass')
lock.release()
s.prompt(timeout=200)
print('stopped ds...')
if condition == 'met':
np = len(list1)
p = multiprocessing.Pool(np)
p.map(stop, [(ds) for ds in list1])
On Mon, Nov 9, 2015 at 7:37 AM, wrote:
> Hi,
>
> I am using multiprocessing with pexpect, issue is whenever i call a
> function which is having expect(), its throwing error which is genuine as
> multiple threads are processing it same time (i/o prompt same time by
> multiple processes..so issues in picture...), so i want to use lock for
> that section alone to avoid it, but still fails in implementing it...can
> you help me
>
> username = input('Enter your username: ')
> password = getpass.getpass()
>
> s = pxssh.pxssh()
> s.login ('host','username','password')
> s.sendline ('ps -ef|grep java')
> s.prompt(timeout=1)
>
> Try 1:
>
> if condition == 'met':
>np = len(list1)
>p = multiprocessing.Pool(np)
>p.map(stop, [(ds) for ds in list1])
>
> def stop(ds):
> s.sendline ('cd /usr')
> if condition:
> lock = threading.Lock()
> lock.acquire()
> s.expect('Enter username:')
> s.sendline ('user')
> s.expect('Enter password:*')
> s.sendline('pass')
> lock.release()
> s.prompt(timeout=200)
> print('stopped ds...')
>
> Try 2:
>
> if condition == 'met':
> lock = Lock()
> for ds in list1:
> Process(target=stop, args=(ds,lock)).start()
>
> def stop(ds,l):
> s.sendline ('cd /usr')
> if condition:
> l.acquire()
> s.expect('Enter username:')
> s.sendline ('user')
> s.expect('Enter password:*')
> s.sendline('pass')
> l.release()
> s.prompt(timeout=200)
> print('stopped ds...')
>
> Both are giving me same trace..
>
> pexpect.ExceptionPexpect: isalive() encountered condition where
> "terminated" is 0, but there was no child process. Did someone else call
> waitpid() on our process?
>
> Thanks in Advance
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
*Pablo Lucena*
--
https://mail.python.org/mailman/listinfo/python-list
Keeping context-manager object alive through function calls
I am running into a bit of an issue with keeping a context manager open
through function calls. Here is what I mean:
There is a context-manager defined in a module which I use to open SSH
connections to network devices. The "setup" code handles opening the SSH
sessions and handling any issues, and the teardown code deals with
gracefully closing the SSH session. I normally use it as follows:
from manager import manager
def do_stuff(device):
with manager(device) as conn:
output = conn.send_command("show ip route")
#process output...
return processed_output
In order to keep the SSH session open and not have to re-establish it
across function calls, I would like to do add an argument to "do_stuff"
which can optionally return the SSH session along with the data returned
from the SSH session, as follows:
def do_stuff(device, return_handle=False):
with manager(device) as conn:
output = conn.send_command("show ip route")
#process output...
if return_handle:
return (processed_output, conn)
else:
return processed_output
I would like to be able to call this function "do_stuff" from another
function, as follows, such that it signals to "do_stuff" that the SSH
handle should be returned along with the output.
def do_more_stuff(device):
data, conn = do_stuff(device, return_handle=True)
output = conn.send_command("show users")
#process output...
return processed_output
However the issue that I am running into is that the SSH session is closed,
due to the do_stuff function "returning" and triggering the teardown code
in the context-manager (which gracefully closes the SSH session).
I have tried converting "do_stuff" into a generator, such that its state is
suspended and perhaps causing the context-manager to stay open:
def do_stuff(device, return_handle=False):
with manager(device) as conn:
output = conn.send_command("show ip route")
#process output...
if return_handle:
yield (processed_output, conn)
else:
yield processed_output
And calling it as such:
def do_more_stuff(device):
gen = do_stuff(device, return_handle=True)
data, conn = next(gen)
output = conn.send_command("show users")
#process output...
return processed_output
However this approach does not seem to be working in my case, as the
context-manager gets closed, and I get back a closed socket.
Is there a better way to approach this problem? Maybe my generator needs
some more work...I think using a generator to hold state is the most
"obvious" way that comes to mind, but overall should I be looking into
another way of keeping the session open across function calls?
Thanks
--
*Pablo Lucena*
--
https://mail.python.org/mailman/listinfo/python-list
[OT] Python Argentina T-shirt to exchange
Hi guys, sorry for this _very_ off-topic message. I'll be in Paris, France next week and I thought someone there might be interested to exchange this http://www.python.com.ar/moin/Remeras T-shirt (size M) with me? I'd really like to take home a py-french (or wherever) one instead. Thanks and sorry again if this has been an inappropriate place to make the request. Pablo -- http://mail.python.org/mailman/listinfo/python-list
Permutations with generators
Hey guys! For the last couple of days, I've been fighting a war against generators and they've beaten the crap out of me several times. What I want to do is implement one that yields every possible permutation of a given sequence (I had lists in mind, but I could swear that this would work on strings too...if it worked at all). Here's what I have so far: def perm(seq): "Reshuffles the elements of seq in every possible way" if len(seq) == 1: yield seq else: for p in perm(seq[1:]): for i in range(len(seq)): yield p.insert(i, seq[0]) Basically, I let the recursion reshuffle the elements of the subsequence that starts from the second element of the original one, and then I insert seq[0], the first element of the original sequence, in every position of the shuffled sublist. Here's what I get when I try to list the permutations of [1, 2, 3, 4] (print list(perm([1, 2, 3, 4]))): Traceback (most recent call last): File "perm.py", line 15, in print list(perm([1, 2, 3, 4])) File "perm.py", line 11, in perm for p in perm(seq[1:]): File "perm.py", line 13, in perm yield p.insert(i, seq[0]) AttributeError: 'NoneType' object has no attribute 'insert' Could somebody please explain to me why my p variable has no type at all? For every call to perm(seq), seq should always be of the same type as the sequence that was used in the first call. Any ideas as to where seq loses it's type? Thanks in advance, Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Permutations with generators
Just a quick P.S: This WOULD NOT work with strings, because of seq.insert() In very other aspect, I'm still lost. -- http://mail.python.org/mailman/listinfo/python-list
Re: Permutations with generators
> > list.insert returns None. Thus, except in the one-element case, your > generator is yielding None all the time. > Oh god...silly me. Thank you guys for the help :) P.S I'm dead stubborn, so here's what I did to fix my code: def perm(seq): "Reshuffles the elements of seq in every possible way" if len(seq) == 1: yield seq else: for i in range(len(seq)): for p in perm(seq[1:]): # Here: p.insert(i, seq[0]) yield p -- http://mail.python.org/mailman/listinfo/python-list
Threading
Hello, I'm trying to call Python routines from C/C++. These routines must intereact in a multi-thread environment. I mean that routine A will loop waiting for a condition of routine B. This condition are coded in C so I don't need routine A running in the same interpreter of routine B. I tried using: PyEval_AcquireLock(); PyInterpreterState* mainInterpreterState = mainThreadState->interp; PyThreadState * myThreadState = PyThreadState_New(mainInterpreterState); PyThreadState_Swap(myThreadState); ... Call Python code here PyThreadState_Swap(NULL); PyEval_ReleaseLock(); Obviosly, I called thread initialization code in the main thread like http://www.linuxjournal.com/article/3641 The problem with this code is that I hold the interpreter lock when calling routine A or B so they cannot run simultaneous and that is a requierement for me (as I explained before). It executes some code of the routine I called but then it hungs. If I release the lock before calling the Python code it doesn´t work neither somhow. Then I tried to create an interpreter for each thread. It is not desirable but it's acceptable: PyEval_AcquireLock(); PyThreadState* myThreadState = Py_NewInterpreter(); PyThreadState_Swap(myThreadState); PyEval_ReleaseLock(); ... Call Python code here PyEval_AcquireLock(); PyThreadState_Swap(NULL); Py_EndInterpreter(myThreadState); PyEval_ReleaseLock(); But it doesn't work. It seems that it requieres to take the lock to call Python code. If I comment the PyEval_ReleaseLock line and PyEval_AcquireLock pair it calls other threads before hunging. I saw some threads talking about some similar situations and I saw no answer to this. This issue remains unsolved? Thanks on advance, Pablo -- http://www.nektra.com -- http://mail.python.org/mailman/listinfo/python-list
C++ Binding with Threads
Hello, I want to embed Python in an application and use an API of the application from Python. The application uses a library that creates several threads and I the users of the application will write Python scripts handling this events. The problem is that I having problems with threads. I saw that I have to PyEval_InitThreads and then PyThreadState_New and PyThreadState_Swap from the new thread but this way to solve the problem doesn't work for me because I need to let 2 or more threads run at the SAME time. The interpreter lock doesn't let them run at the same time so I'm looking for another solution. I saw Py_NewInterpreter and I tried to use it but it doesn't work if I don't keep the lock. Can anyone help me to solve this issue or tell me 'Forget it!'? Thanks on advance, Pablo Yabo -- http://mail.python.org/mailman/listinfo/python-list
C++ Binding with Threads
Hello, I want to embed Python in an application and use an API of the application from Python. The application uses a library that creates several threads and I the users of the application will write Python scripts handling this events. The problem is that I having problems with threads. I saw that I have to PyEval_InitThreads and then PyThreadState_New and PyThreadState_Swap from the new thread but this way to solve the problem doesn't work for me because I need to let 2 or more threads run at the SAME time. The interpreter lock doesn't let them run at the same time so I'm looking for another solution. I saw Py_NewInterpreter and I tried to use it but it doesn't work if I don't keep the lock. Can anyone help me to solve this issue or tell me 'Forget it!'? Thanks on advance, Pablo Yabo -- http://www.nektra.com -- http://mail.python.org/mailman/listinfo/python-list
Syntax Question - list multiplication
Hi guys! I am working on Conway's Game of Life right now and I've run into a little problem. I represent dead cells with 0s and live ones with 1s. Check this out: >>> grid = [[0] * 3] * 3 >>> grid [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> grid[0][0] = 1 [[1, 0, 0], [1, 0, 0], [1, 0, 0]] Now, that's not what I want. I just want the first element of the first sublist to be a 1, not the first of every one. Here's what I tried and didn't work: 0. grid = [[0] * 3][:] * 3then the same grid[0][0] = 1 statement 1. grid = [[0][:] * 3] * 3followed by the same assignment 2. (grid[0])[0] = 1with the original initialization of the grid So, that means that it isn't a problem with two different variables refering to the same list (0. and 1. prove that). What I don't understand is why 2. doesn't work either. I'm baby-feeding my instructions to Python and the mistake is still there. Any ideas? Hope you can help. Thanks in advance, Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax Question - list multiplication
Thanks everyone. Now I see why every row in my grid were actually the same object. Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python question (PyNoob)
On Aug 19, 7:33 pm, Anonymous <[EMAIL PROTECTED]> wrote: > I have exp with C/C++ (and a few other langs). I want to use Python to > start doing the ff: > > 1). Data Munging (text processing) - instead of Perl > 2). Automating my build process > 3). (Possibly) some web data retrieval jobs > > Can anyone point me to resurces/possibly scripts that can get me up to > speed (to do these 3 things) ASAP, without having to learn the basics of > programming? Sure. Go here: http://www.google.com, then type all that and hit "Google Search". That should turn up a wealth of information. P.S You can't do all that without learning the basics of programming. -- http://mail.python.org/mailman/listinfo/python-list
Re: Any advice on ways for sharing a small Python application with the world?
On Aug 20, 4:59 pm, Bert Heymans <[EMAIL PROTECTED]> wrote: > Hi, > > I made a Python cli application for resizing batches of images based > on the PIL. You can find it herehttp://heymans.org/pyresize.html > > It's just an straight forward command line interface application but I > guess many people would find a use for it, it can be used as a module > as well. There's lots of comments in the code and a chunk of > documentation. > > This post is a way to get the word out, I blogged about it (http:// > blog.heymans.org) and submitted it to the Vaults of Parnassus (http:// > py.vaults.ca/) does anyone know of other ways to share something that > might just be too small for a sourceforge project but too big to be a > snippet? > > Thanks! > > Cheers > > Bert Heymans www.uselesspython.com is not as useless as it sounds. I think it's popular enough. -- http://mail.python.org/mailman/listinfo/python-list
Re: C++ Binding with Threads
I've found a workaround for me project that I'll share.
The solution is to release the interpreter lock when a function of my wapper
is called, I mean from Python a function of C++ is called so I released the
interpreter lock and take it before returning to Python.
It's important to provide Sleep functions in your C++ code. Otherwise,
multi-threading will not work at all. If most of the work is done in your
C++ code, using this workaround will solve the issue.
To make it easier I've wrote a class to create an instance at the beginning
of each wrapped function.
Here is the constructor / destructor:
PythonAutoLock::PythonAutoLock()
{
PythonMgr *mgr = PythonMgr::instance();
_state = PyThreadState_Get();
PyThreadState_Swap(NULL);
PyEval_ReleaseLock();
}
PythonAutoLock::~PythonAutoLock()
{
PythonMgr *mgr = PythonMgr::instance();
PyEval_AcquireLock();
PyThreadState_Swap(_state);
}
Pablo Yabo
--
http://www.nektra.com
On 8/13/07, Pablo Yabo <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I want to embed Python in an application and use an API of the application
> from Python.
> The application uses a library that creates several threads and I the
> users of the application will write Python scripts handling this events.
>
> The problem is that I having problems with threads. I saw that I have to
> PyEval_InitThreads and then PyThreadState_New and PyThreadState_Swap from
> the new thread but this way to solve the problem doesn't work for me because
> I need to let 2 or more threads run at the SAME time.
> The interpreter lock doesn't let them run at the same time so I'm looking
> for another solution. I saw Py_NewInterpreter and I tried to use it but it
> doesn't work if I don't keep the lock.
>
> Can anyone help me to solve this issue or tell me 'Forget it!'?
>
>
> Thanks on advance,
> Pablo Yabo
> --
> http://www.nektra.com
>
--
http://mail.python.org/mailman/listinfo/python-list
SAXParseException: not well-formed (invalid token)
Dear Colleagues,
I am getting the following error with a XML page:
> File "/home/prey/RAL-CESGA/bin/voms2users/voms2users.py", line 69, in
> getItems
> d = minidom.parseString(xml.read())
> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py", line 967,
> in parseString
> return _doparse(pulldom.parseString, args, kwargs)
> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py", line 954,
> in _doparse
> toktype, rootNode = events.getEvent()
> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/pulldom.py", line 265,
> in getEvent
> self.parser.feed(buf)
> File "/usr/lib/python2.2/site-packages/_xmlplus/sax/expatreader.py", line
> 208, in feed
> self._err_handler.fatalError(exc)
> File "/usr/lib/python2.2/site-packages/_xmlplus/sax/handler.py", line 38,
> in fatalError
> raise exception
> xml.sax._exceptions.SAXParseException: :553:48: not well-formed
> (invalid token)
> def getItems(page):
> opener =urllib.URLopener(key_file=HOSTKEY,cert_file=HOSTCERT) ;
> try:
>xml = opener.open(page)
> except:
>return []
>
> d = minidom.parseString(xml.read())
> items = d.getElementsByTagName('item')
> data = []
> for i in items:
>data.append(getText(i.childNodes))
>
> return data
The page is
https://lcg-voms.cern.ch:8443/voms/cms/services/VOMSCompatibility?method=getGridmapUsers
and the line with the invalid character is (the invalid character is the
final é of Université):
/C=BE/O=BEGRID/OU=Physique/OU=Univesité Catholique de
Louvain/CN=Roberfroid
I have tried several options but I am not able to avoid this problem.
Any idea?.
I am starting to work with Python so I am sorry if this problem is
trivial.
Thanks for your time.
Pablo Rey
--
http://mail.python.org/mailman/listinfo/python-list
Re: SAXParseException: not well-formed (invalid token)
Hi Stefan,
The xml has specified an encoding ().
About the possibility that you mention to recoding the input, could you
let me know how to do it?. I am sorry I am starting with Python and I
don't know how to do it.
Thanks by your help.
Pablo
On 30/08/2007 14:37, Stefan Behnel wrote:
> Pablo Rey wrote:
>> I am getting the following error with a XML page:
>>
>>> File "/home/prey/RAL-CESGA/bin/voms2users/voms2users.py", line 69,
>>> in getItems
>>> d = minidom.parseString(xml.read())
>>> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py",
>>> line 967, in parseString
>>> return _doparse(pulldom.parseString, args, kwargs)
>>> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py",
>>> line 954, in _doparse
>>> toktype, rootNode = events.getEvent()
>>> File "/usr/lib/python2.2/site-packages/_xmlplus/dom/pulldom.py",
>>> line 265, in getEvent
>>> self.parser.feed(buf)
>>> File "/usr/lib/python2.2/site-packages/_xmlplus/sax/expatreader.py",
>>> line 208, in feed
>>> self._err_handler.fatalError(exc)
>>> File "/usr/lib/python2.2/site-packages/_xmlplus/sax/handler.py",
>>> line 38, in fatalError
>>> raise exception
>>> xml.sax._exceptions.SAXParseException: :553:48: not
>>> well-formed (invalid token)
>>
>>> def getItems(page):
>>> opener =urllib.URLopener(key_file=HOSTKEY,cert_file=HOSTCERT) ;
>>> try:
>>>xml = opener.open(page)
>>> except:
>>>return []
>>>
>>> d = minidom.parseString(xml.read())
>>> items = d.getElementsByTagName('item')
>>> data = []
>>> for i in items:
>>>data.append(getText(i.childNodes))
>>>
>>> return data
>> The page is
>> https://lcg-voms.cern.ch:8443/voms/cms/services/VOMSCompatibility?method=getGridmapUsers
>> and the line with the invalid character is (the invalid character is the
>> final é of Université):
>>
>> /C=BE/O=BEGRID/OU=Physique/OU=Univesité Catholique de
>> Louvain/CN=Roberfroid
>>
>>
>> I have tried several options but I am not able to avoid this
>> problem. Any idea?.
>
> Looks like the page is not well-formed XML (i.e. not XML at all). If it
> doesn't specify an encoding (), you can try recoding the
> input, possibly decoding it from latin-1 and re-encoding it as UTF-8 before
> passing it to the SAX parser.
>
> Alternatively, tell the page authors to fix their page.
>
> Stefan
--
http://mail.python.org/mailman/listinfo/python-list
Re: regex with specific list of string
Carsten Haese wrote: > On Wed, 2007-09-26 at 15:42 +, james_027 wrote: > >> hi, >> >> how do I regex that could check on any of the value that match any one >> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >> 'sep', 'oct', 'nov', 'dec' >> > > Why regex? You can simply check if the given value is contained in the > set of allowed values: > > >>>> s = set(['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >>>> > 'sep', 'oct', 'nov', 'dec']) > >>>> 'jan' in s Also, check calendar for a locale aware (vs hardcoded) version: >>> import calendar >>> [calendar.month_abbr[i].lower() for i in range(1,13)] ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] If you still want to use regexes, you can do something like: >>> import re >>> pattern = '(?:%s)' % '|'.join(calendar.month_abbr[1:13]) >>> pattern '(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)' >>> re.search(pattern, "we are in september", re.IGNORECASE) <_sre.SRE_Match object at 0xb7ced640> >>> re.search(pattern, "we are in september", re.IGNORECASE).group() 'sep' If you want to make sure that the month name begins a word, use the following pattern instead: >>> pattern = r'(?:\b%s)' % r'|\b'.join(calendar.month_abbr[1:13]) >>> pattern '(?:\\bJan|\\bFeb|\\bMar|\\bApr|\\bMay|\\bJun|\\bJul|\\bAug|\\bSep|\\bOct|\\bNov|\\bDec)' If in doubt, Google for "regular expressions in python" or go to http://docs.python.org/lib/module-re.html Regards, Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: regex with specific list of string
Carsten Haese wrote:
> On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote:
>> james_027 wrote:
>>> hi,
>>>
>>> how do I regex that could check on any of the value that match any one
>>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
>>> 'sep', 'oct', 'nov', 'dec'
>>>
>>> Thanks
>> >>> patr = re.compile('jan|feb|mar|apr|may|jun|jul|aug|sep|nov|oct|dec')
>> >>> patr.match("jul")
>> <_sre.SRE_Match object at 0x7ff28ad8>
>> >>> patr.match("nosuch")
>
> Unfortunately, that also matches margarine, mayonnaise, and octopus,
> just to name a few ;-)
(and so does the solution you sent before :)
This is fine IMO since the OP didn't specify the opposite.
BTW in my previous post I included an example that ensures that the
search month matches the beginning of a word. That was based in that
maybe he wanted to match e.g. "dec" against "December" (BTW, it should
have been r'\b(?:Jan|Feb|...)' instead). To always match a whole word, a
trailing \b can be added to the pattern OR (much better) if the month
can appear both in its abbreviated and full form, he can use the
extensive set as follows (I hope this is clear, excuse my Thunderbird...):
>>> pattern = r"\b(?:%s)\b" % '|'.join(calendar.month_name[1:13] +
calendar.month_abbr[1:13])
>>> pattern
'\\b(?:January|February|March|April|May|June|July|August|September|October|November|December|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\b'
>>> target = "Unlike Julia, I like apricots with mayo in august or sep"
>>> target
'Unlike Julia, I like apricots with mayo in august or sep'
>>> re.findall(pattern, target, re.IGNORECASE)
['august', 'sep']
>>> re.search(pattern, target, re.IGNORECASE)
<_sre.SRE_Match object at 0xb7ced640>
>>> re.findall(pattern, target, re.IGNORECASE)
['august', 'sep']
Regards,
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: ValueError: too many values to unpack
Zentrader wrote:
> On Sep 27, 9:46 am, Shawn Minisall <[EMAIL PROTECTED]> wrote:
>
>> line 3 - 19.1829.1578.75212.10
>> line 4 - 10020410.29
>> And this is the code I'm using:
>>
>>#read withdrawls from file on line3
>>line = infile.readline()
>> #split withdrawls up
>>withdraw1, withdraw2, withdraw3, withdraw4 = string.split(line, "\t")
>>
>>#read deposits from file on line4
>>line = infile.readline()
>>#split deposits up
>>deposit1, deposit2, deposit3 = string.split(line, "\t")
>>
>> I have 4 strings to match line 3 and 3 to match the 3 on line 4...any
>> thoughts?
>>
>
> A string.split returns a list so you don't have to know how many
> elements there are beforehand. A simple example
> withdraw = line.split("\t")
> if len(withdraw) == 3:
>match_3(withdraw)
> elif len(withdraw) == 4::
>match_4(withdraw)
> else:
>print "line.split() is not 3 or 4", withdraw
Right, and then because error was caused for an unexpected extra tab you
made the deposit pass as a withdrawal...
Not everybody trades just Zen :)
(tip: the unpacking mystery has been solved earlier this day)
Regards,
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: Program inefficiency?
[EMAIL PROTECTED] wrote:
> Is there a solution here that I'm missing? What am I doing that is so
> inefficient?
>
Hi Jeff,
Yes, it seems you have plenty of performance leaks.
Please see my notes below.
> def massreplace():
> editfile = open("pathname\editfile.txt")
> filestring = editfile.read()
> filelist = filestring.splitlines()
> ##errorcheck = re.compile('(a name=)+(.*)(-)+(.*)(>)+')
> for i in range(len(filelist)):
> source = open(filelist[i])
>
>
Read this post:
http://mail.python.org/pipermail/python-list/2004-August/275319.html
Instead of reading the whole document, storing it in a variable,
splitting it and the iterating, you could simply do:
def massreplace():
editfile = open("pathname\editfile.txt")
for source in editfile:
> starttext = source.read()
> interimtext = replacecycle(starttext)
> (...)
>
Excuse me, but this is insane. Do just one call (or none at all, I don't
see why you need to split this into two functions) and let the function
manage the replacement "layers".
I'm skipping the next part (don't want to understand all your logic now).
> (...)
>
> def replacecycle(starttext):
>
Unneeded, IMHO.
> p1= re.compile('(href=|HREF=)+(.*)(#)+(.*)( )+(.*)(">)+')
> (...)
> interimtext = p100.sub(q2, interimtext)
>
Same euphemism applies here. I might be wrong, but I'm pretty confident
you can make all this in one simple regex.
Anyway, although regexes are supposed to be cached, don't need to define
them every time the function gets called. Do it once, outside the
function. At the very least you save one of the most important
performance hits in python, function calls. Read this:
http://wiki.python.org/moin/PythonSpeed/PerformanceTips
Also, if you are parsing HTML consider using BeautifulSoup or
ElementTree, or something (particularly if you don't feel particularly
confident with regexes).
Hope you find this helpful.
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: Program inefficiency?
thebjorn wrote: > On Sep 29, 5:22 pm, [EMAIL PROTECTED] wrote: > >> I wrote the following simple program to loop through our help files >> and fix some errors (in case you can't see the subtle RE search that's >> happening, we're replacing spaces in bookmarks with _'s) >> (...) >> > > Ugh, that was entirely too many regexps for my taste :-) > > How about something like: > > def attr_ndx_iter(txt, attribute): > (...) > def substr_map(txt, indices, fn): > (...) > def transform(s): > (...) > def zap_spaces(txt, *attributes): > (...) > def mass_replace(): > (...) Oh yeah, now it's clear as mud. I do think that the whole program shouldn't take more than 10 lines of code using one sensible regex (impossible to define without knowing the real input and output formats). And (sorry to tell) I'm convinced this is a problem for regexes, in spite of anybody's personal taste. Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: strange unbound local error?
[EMAIL PROTECTED] wrote: > spam = 42 > > def eggs(): > print spam > spam = spam + 1 > > if __name__=="__main__": > eggs() > > This thows an UnboundLocalError at line 4 (print statement). But if I > comment out line 5 (variable assignment), no error occurs. > > Can you explain me this, please? Hi Enrico, You need to say that you will be modifying the variable in the global scope, like this: spam = 42 def eggs(): global spam # <--here print spam spam = spam + 1 if __name__=="__main__": eggs() This can help you: http://www.pasteur.fr/recherche/unites/sis/formation/python/ch04.html Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Program inefficiency?
thebjorn wrote:
On Sep 29, 7:55 pm, Pablo Ziliani <[EMAIL PROTECTED]> wrote:
thebjorn wrote:
Ugh, that was entirely too many regexps for my taste :-)
Oh yeah, now it's clear as mud.
I'm anxiously awaiting your beacon of clarity ;-)
Admittedly, that was a bit arrogant from my part. Sorry.
I do think that the whole program shouldn't take more than 10 lines of
code
Well, my mass_replace above is 10 lines, and the actual replacement
code is a one liner. Perhaps you'd care to illustrate how you'd
shorten that while still keeping it "clear"?
I don't think he relevant code was only those 10 lines, but well, you
have already responded to the other question yourself in a subsequent
post (thanks for saving me a lot of time).
I think that "clear" is a compromise between code legibility (most of
what you sacrifice using regexes) and overall code length. Even regexes
can be legible enough when they are well documented, not to mention the
fact that is an idiom common to various languages.
using one sensible regex
I have no doubt that it would be possible to do with a single regex.
Whether it would be sensible or not is another matter entirely...
Putting it in those terms, I completely agree with you (that's why I
suggested letting e.g. BeautifulSoup deal with them). But by "sensible"
I meant something different, inherent to the regex itself.
For instance, I don't think I need to explain to you why this is not
sensible: (href=|HREF=)+(.*)(#)+(.*)(\w\'\?-<:)+(.*)(">)+
(impossible to define without knowing the real input and output formats).
Of course, but I don't think you can guess too terribly wrong. My
version handles upper and lower case attributes, quoting with single
(') and double (") quotes, and any number of spaces in attribute
values. It maintains all other text as-is, and converts spaces to
underscores in href and name attributes. Did I get anything majorly
wrong?
Well, you spent some time interpreting his code. No doubt you are smart,
but being a lazy person (not proud of that, unlike other people stating
the same) I prefer leaving that part to the interested party.
And (sorry to tell) I'm convinced this is a problem for regexes, in
spite of anybody's personal taste.
Well, let's see it then :-)
IMO, your second example proves it well enough.
FWIW I did some changes to your code (see attached), because it wasn't
taking into account the tag name (), and the names of the attributes
(href, name) can appear in other tags as well, so it's a problem. It
still doesn't solve the problem of one tag having both attributes with
spaces (which can be easily fixed with a second regex, but that was out
of question :P), and there can be a lot of other problems (both because
I'm far from being an expert in regexes and because I only tested it
against the given string), but should provide at least some guidance.
I made it also match the id of the target anchor, since a fragment can
point both to its name or its id, depending on the doctype.
Regards,
Pablo
import re
tests = """base case
not a link
still, not a link
some text
zzz
other attributes
two in a row
both attributes
all three attributes
"""
pattern = r'''[^>]*?)
(?:
href=["'](?P[^#]*)[#](?P[^"']+)["'] |
(?Pname|id)=(?P
["'][^"']+["'] |
[^\s>]+
)
)'''
regex = re.compile(pattern, re.IGNORECASE | re.MULTILINE | re.VERBOSE)
to_replace = re.compile("[^\w\"'-]") #replaces everything but letters, hyphens and quotes
def replace(match):
groups = match.groupdict()
result = "--
http://mail.python.org/mailman/listinfo/python-list
Re: List Question
Paul Hankin wrote: > On Oct 2, 10:06 pm, brad <[EMAIL PROTECTED]> wrote: > >> How is this expressed in Python? >> >> If x is in y more than three times: >> print x >> >> y is a Python list. >> > > Simple and readable: > if len([a for a in y if x == a]) > 3: > print x > > Or the slightly-too-flashy version: > if sum(1 for a in y if x == a) > 3: > print x I always use this full-featured, all-inclusive, rock-solid version (see the try/except block): count = i = 0 x = 1 y = [1,2,3,4,5,1,2,3,4,1,2,1] try: while count < 3: if y[i] == x: count += 1 i += 1 except RuntimeError: pass except IndexError: pass else: print x Sorry, couldn't resist... -- http://mail.python.org/mailman/listinfo/python-list
Thread structures BUG?
Hello, I create lots of threads that run a script and I have a problem when a thread is created with the same threadId that existed before. When a new thread is started I use this code to enter the interpreter: // create a thread state object for this thread PyEval_AcquireLock(); threadState = PyThreadState_New(mainInterpreterState); PyThreadState_Swap(threadState); and when the thread finishes: PyThreadState_Swap(NULL); PyThreadState_Clear(info); // delete my thread state object PyThreadState_Delete(info); PyEval_ReleaseLock(); Everything works smoothly until a thread id is re-used. I've been testing what is happening and the problem is that PyGILState_GetThisThreadState() returns a PyThreadState for the reused thread id. I changed my code to call PyGILState_GetThisThreadState() before creating the PyThreadState. But if I try to use the returned PyThreadState (that shouldn't exist because I've already deleted) I got an error when trying to access the interpreter dictionary. The workaround that I found is to keep all PyThreadState structures without calling PyThreadState_Clear / PyThreadState_Delete. When a new thread is created I call PyGILState_GetThisThreadState(). If it returns something I reuse the structure. In this way, my code works. Thanks, Pablo Yabo -- http://www.nektra.com -- http://mail.python.org/mailman/listinfo/python-list
Re: reading list of list to a file
Hi Croliina, caroliina escribió: > i made a list of lists Please notice that this problem: > but i cant write it into a file. has nothing to do with this other one: > how do i get the > first string in a sublist? > For the first one, it is impossible to answer without seeing some actual code. How are you opening/saving the "list"? are you using Pickle or some serializer? are you just trying to write on regular a text file? Also, it would really help you to get appropriate answers from the list if you try to explain a little further what is your actual goal. For the latter, you already got good answers. Regards, Pablo PS: I'm mostly in read-only mode in this list, but admittedly, I couldn't resist to write to a hot.ee girl :) -- http://mail.python.org/mailman/listinfo/python-list
Re: searching a value of a dict (each value is a list)
Seongsu Lee escribió: > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > (...) > > I want to find out the key value which has a specific > integer in the list of its value. Sorry if this is unhelpful, but have you considered moving your data model a proper database? I ask because unless someone knows of a specific module, I think we are in DB's authentic realm. Is the fastest solution, probably not just for this particular operation you are trying to do. Regards, Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing interfaces in Python...
This article in Guido van Rossum's blog might be interesting for this thread http://www.artima.com/weblogs/viewpost.jsp?thread=92662 -- Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's great, in a word
[EMAIL PROTECTED] wrote: > Would you Python old-timers try to agree on a word or two that > completes: > > The best thing about Python is ___. Hi Martin, here is my top three: 1) Fun 2) Simplicity 3) Productivity -- http://mail.python.org/mailman/listinfo/python-list
Re: Python's great, in a word
Dustan wrote: > On Jan 7, 11:40 am, Martin Marcher <[EMAIL PROTECTED]> wrote: > >> it's pythonicness. >> > > "it is pythonicness"??? > Obviously a typo, for "It is pythonic, Ness". A reference to the well-known Loch Ness Monster, definitely pythonic if you see some pictures: http://images.google.com/images?q=loch+ness My 2 cents, Pablo -- http://mail.python.org/mailman/listinfo/python-list
Re: alternating string replace
cesco wrote: > Hi, > > say I have a string like the following: > s1 = 'hi_cat_bye_dog' > and I want to replace the even '_' with ':' and the odd '_' with ',' > so that I get a new string like the following: > s2 = 'hi:cat,bye:dog' > Is there a common recipe to accomplish that? I can't come up with any > solution... What about: >>> import re >>> s1 = 'hi_cat_bye_dog' >>> print re.sub(r'([^_]+)_([^_]+)_?', r'\1:\2;', s1) hi:cat;bye:dog; it still works for a longer string: >>> s1 = 'hi_cat_bye_dog_' + s1 >>> s1 'hi_cat_bye_dog_hi_cat_bye_dog' >>> print re.sub(r'([^_]+)_([^_]+)_?', r'\1:\2;', s1) hi:cat;bye:dog;hi:cat;bye:dog; -- http://mail.python.org/mailman/listinfo/python-list
Re: alternating string replace
Paul Rubin wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
>
>> from itertools import chain, izip, cycle
>> print ''.join(chain(*izip(s1.split('_'),cycle(':,'[:-1]
>>
>
> from itertools import cycle
> a = cycle(':,')
> print re.sub('_', lambda x: a.next(), s1)
>
Lovely.
If there OP didn't vanished into thin air*, I'd declare you the winner
(although you forgot to import re).
This said, I'm still kind of partial to any re-only solution, but it
would require someone outlines the behavior in the corner cases.
* die, thread!
--
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: Increment Variable Name
Hi David,
David Brochu wrote:
> I know the length of a list and I want to pass each element of a list
> to a unique variable, thus I want to increment variable names. If the
> list length = 4, i want to have the following variables: var1, var2,
> var3, var4.
yuck... no, believe me, you probably don't want to do that.
Why don't you tell us what you are actually trying to achieve instead?
(I mean, the problem, not the solution)
if you are REALLY sure that you want is what you asked:
>>> for var in enumerate(['welcome', 'to', 'php']):
... exec "var%s=%r"% var
...
>>> vars()
{'var1': 'to', 'var0': 'welcome', 'var2': 'php', '__builtins__': , 'var': (2, 'php'), '__name__': '__main__',
'__doc__': None}
(I'm assuming that you have builtin objects in your list)
This is completely unsafe and error prone. IOW horrible.
HTH,
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: Increment Variable Name
Ben Finney wrote: > This has a very bad code smell (...) > > \ `\ _o__) Ben Finney That is forcefulness. (sorry, couldn't resist) -- http://mail.python.org/mailman/listinfo/python-list
Re: Increment Variable Name
David Brochu wrote:
> Pablo - Thanks for the reply.
>
> Basically what I am trying to do is pass each value from a list to the
> following line of code (where XXX is where I need to pass each value
> of the list
>
> tests = easygui.multchoicebox(message="Pick the test(s) you would like
> to run from the list below."
> , title="Validation Tests"
> ,choices=[XXX])
>
> If i were to manually pass values to this line it would appear like :
> tests = easygui.multchoicebox(message="Pick the test(s) you would like
> to run from the list below."
> , title="Validation Tests"
> ,choices=["Test 1","Test 2", "Test 3"])
>
> When I actually pass the list to the line of code, it works, however
> it doesn't really split the list by element. The desired output of
> this line of code would be a GUi that included a list consisting of
> each element from the passed list. Right now I can only get it to
> consist of a single element that contains every part of the list.
>
> Does this make sense?
David,
I am reposting this to the list to let other people provide you with a
probable better answer.
I'm not really gui-oriented, so I might have a narrow sight of the problem.
I downloaded and tried the easygui script. Looks like your actual
problem is it's lack of support for value/text pairs. So, depending on
your actual needs I'd consider using a "less than easy" library.
If you still want/need to stick with this one, you will have to pass the
index as part of the label and parse the answer afterwards. You could do
something like:
# starts code:
import easygui
def getIndex(choice):
return int(choice.split('.', 1)[0]) - 1
choices = ['Personality Test', 'Political Test', 'Driving Test', 'Icules
Test']
labels = ["%s. %s" % item for item in enumerate(['dummy'] + choices)][1:]
answer = easygui.multchoicebox(
message="Pick the test(s) you would like to run from the list
below.",
title="Validation Tests",
choices=labels
)
tests = [getIndex(item) for item in answer]
# ends code
After this, the variable "tests" holds the list of the chosen indexes,
that you can use to get any value from the actual objects you had in
your original list.
A much simple approach (given the fact that you will probably never have
two identical labels) is to simply use list.index, but given
easygui.multchoicebox's nature, you will first have to sort your objects
labels aphabetically:
# starts code:
import easygui
labels = ['Personality Test', 'Political Test', 'Driving Test', 'Icules
Test']
labels.sort()
answer = easygui.multchoicebox(
message="Pick the test(s) you would like to run from the list
below.",
title="Validation Tests",
choices=labels
)
tests = [labels.index(item) for item in answer]
# ends code
Notice that these indexes refer to the labels order, not necessary your
original objects'. Supposing you initially had a list of dictionaries,
you will have to sort that list by the labels first. E.g.:
>>> objects = [{'label': 'Personality Test', 'cargo': 'something'},
{'label': 'Political Test', 'cargo': 'something'}, {'label': 'Driving
Test', 'cargo': 'something'}, {'label': 'Icules Test', 'cargo':
'something'}]
>>> from operator import itemgetter
>>> objects.sort(key=itemgetter('label'))
>>> objects
[{'cargo': 'something', 'label': 'Driving Test'}, {'cargo': 'something',
'label': 'Icules Test'}, {'cargo': 'something', 'label': 'Personality
Test'}, {'cargo': 'something', 'label': 'Political Test'}]
>>> labels = [obj['label'] for obj in objects]
>>> labels
['Driving Test', 'Icules Test', 'Personality Test', 'Political Test']
HTH,
Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: win32com.client question
On Feb 13, 2008 11:58 AM, James Matthews <[EMAIL PROTECTED]> wrote: > What do you mean possible? > It is possible to use the library win32com.client in linux? I thought that was only for windows ?¿ -- http://mail.python.org/mailman/listinfo/python-list
Spyder 3.1.3 update
Good day, I installed the Spyder 3.6 IDE from the Anaconda package and at the start k to the IDE I get the Spyder Update saying Spyder 3.1.3 is available. Did it incorrectly install Anaconda? As far as I know Spyder 3.1.3 is rather old and the latest is 3.6 Regards Pablo -- https://mail.python.org/mailman/listinfo/python-list
Unsubscribe to Python email list
Good day, I would like to unsubscribe this e-mail to the Python e-mail list. Kind regards -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The first Python 3.11 beta (3.11.0b1) is available - Feature freeze is here
of the entropy larger than those allowed by an area law, hence in principle larger than those of a black hole. These are the so-called "Wheeler's bags of gold". The existence of such solutions conflicts with the holographic interpretation, and their effects in a quantum theory of gravity including the holographic principle are not fully understood yet. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ Regards from chilly London, Your friendly release team, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
Issue sending data from C++ to Python
Hello, I have been using your C++ Python API, in order to establish a bridge from C++ to Python. We want to do this, as we have a tactile sensor, which only has a library developed in C++, but we want to obtain the data in real time in Python to perform tests with a robotic arm and gripper. The problem we are facing is with transmitting the data into Python. We are using the function Py_BuildValue, and it seems to be working, but only for sending one value at a time, and we want to transmit 54 numbers. When transmitting a single value retrieved from the sensor into Python in a double or string format, it works, but when we make the string bigger it gives us an error with the utf-8 encoding. Also when sending a tuple of doubles or strings, it works when the tuple is composed of a single element, but not when we send 2 or more values. Is there any way of fixing this issue? Or is it just not possible to transmit such a large amount of data? Thank you. Best regards, *Pablo Martinez Ulloa* PhD Candidate, School of Electrical and Electronic Engineering, R324A University College Dublin, Belfield, Dublin 4, Ireland -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The second Python 3.11 beta (3.11.0b2) is available
Does anyone want bug fixes? Because we have 164 new commits fixing
different things, from code to documentation. If you have reported some
issue after 3.11.0b1, you should check if is fixed and if not, make sure
you tell us so we can take a look. We still have two more betas to go so
help us to make sure we don't miss anything so everything is ready for the
final release!!
https://www.python.org/downloads/release/python-3110b2/
## This is a beta preview of Python 3.11
Python 3.11 is still in development. 3.11.0b2 is the second 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 prepare
their projects to support the new feature release.
We **strongly encourage** maintainers of third-party Python projects to
**test with 3.11** during the beta phase and report issues found to [the
Python bug tracker](https://github.com/python/cpython/issues) as soon as
possible. While the release is planned to be feature complete entering the
beta phase, it is possible that features may be modified or, in rare cases,
deleted up until the start of the release candidate phase (Monday,
2021-08-02). Our goal is to have no ABI changes after beta 4 and as few
code changes as possible after 3.11.0rc1, the first release candidate. To
achieve that, it will be **extremely important** to get as much exposure
for 3.11 as possible during the beta phase.
Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.
# Major new features of the 3.11 series, compared to 3.10
Many new features for Python 3.11 are still being planned and written.
Among the new major new features and changes so far:
* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and except*
* [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/)-- Variadic Generics
* [PEP 680](https://www.python.org/dev/peps/pep-0680/)-- tomllib: Support
for Parsing TOML in the Standard Library
* [PEP 675](https://www.python.org/dev/peps/pep-0675/)-- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/)-- Marking individual
TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/)-- Data Class
Transforms
* [bpo-46752](https://bugs.python.org/issue46752)-- Introduce task groups
to asyncio
* [bpo-433030](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping ((?>...)) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster Cpython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.
* (Hey, **fellow core developer,** if a feature you find important
is missing from this list, [let Pablo know](mailto:[email protected]
).)
The next pre-release of Python 3.11 will be 3.11.0b3, currently scheduled
for Thursday, 2022-06-16.
# More resources
* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).
# And now for something completely different
The Planck time is the time required for light to travel a distance of 1
Planck length in a vacuum, which is a time interval of approximately
`5.39*10^(−44)` s. No current physical theory can describe timescales
shorter than the Planck time, such as the earliest events after the Big
Bang, and it is conjectured that the structure of time breaks down on
intervals comparable to the Planck time. While there is currently no known
way to measure time intervals on the scale of the Planck time, researchers
in 2020 found that the accuracy of an atomic clock is constrained by
quantum effects on the order of the Planck time, and for the most precise
atomic clocks thus far they calculated that such effects have been ruled
out to around `10^−33` s, or 10 orders of magnitude above the Planck scale.
# We hope you enjoy the new releases!
Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.
https://www.python.org/psf/
Regards from sunny London,
Pablo Galindo Salgado
--
https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Expedited release of Python3.11.0b3!!
Hi everyone, Due to a known incompatibility with pytest and the previous beta release (Python 3.11.0b2) and after some deliberation, me and the rest of the release team have decided to do an expedited release of Python 3.11.0b3 so the community can continue testing their packages with pytest and therefore testing the betas as expected. # Where can I get the new release? https://www.python.org/downloads/release/python-3110b3/ # What happened? Pytest by default rewrites the AST nodes in the testing code to provide better diagnostics when something fails in the test. For doing this, it creates new AST nodes that are then compiled. In Python 3.11, after some changes in the compiler and AST nodes, these new AST nodes that pytest was creating were invalid. This causes CPython to crash in debug mode because we have several assert statements in the compiler, but in release mode this doesn't cause always a crash, but it creates potential corrupted structures in the compiler silently. In 3.11.0b3 we changed the compiler to reject invalid AST nodes, so what was a silent problem and a crash in debug mode turned into an exception being raised. We had a fix to allow the nodes that pytest is creating to work to preserve backwards compatibility but unfortunately, it didn't make it into 3.11.0b2. Is still possible to use pytest with 3.11.0b2 if you add "--assert=plain" to the pytest invocation but given how many users would have to modify their test suite invocation we decided to proceed with a new release that has the fix. # What happens with future beta releases Python 3.11.0b3 should be considered as an extra beta release. Instead of four beta releases, we will have five and the next beta release (3.11.0b4) will happen as scheduled on Thursday, 2022-06-16. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ If you have any questions, please reach out to me or another member of the release team :) Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.5 is available
The latest bugfix drop for Python 3.10 is here: Python 3.10.5. This release packs more than 230 bugfixes and docs changes, so you surely want to update :) You can get it here: https://www.python.org/downloads/release/python-3105/ ## This is the fourth maintenance release of Python 3.10 Python 3.10.5 is the newest major release of the Python programming language, and it contains many new features and optimizations. # Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL 1.1.1 or newer * [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove Py_UNICODE encoder APIs * [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional EncodingWarning [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to be on this list in previous pre-releases but it has been postponed to Python 3.11 due to some compatibility concerns. You can read the Steering Council communication about it [here]( https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/) to learn more. # More resources * [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog ) * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different Strange quarks are the third lightest quarks, which are subatomic particles that are so small, they are believed to be the fundamental particles, and not further divisible. Like down quarks, strange quarks have a charge of -1/3. Like all fermions (which are particles that can not exist in the same place at the same time), strange quarks have a spin of 1/2. What makes strange quarks different from down quarks–apart from having 25 times the mass of down quarks–is that they have something that scientists call "strangeness." Strangeness is basically a resistance to decay against strong force and electromagnetism. This means that any particle that contains a strange quark can not decay due to strong force (or electromagnetism), but instead with the much slower weak force. It was believed that this was a 'strange' method of decay, which is why the scientists gave the particles that name. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The cursed fourth Python 3.11 beta (3.11.0b4) is available
5/)-- Marking individual TypedDict items as required or potentially-missing (Hey, **fellow core developer,** if a feature you find important is missing from this list, [let Pablo know](mailto:[email protected] ).) The next pre-release of Python 3.11 will be 3.11.0b5, currently scheduled for Thursday, 2022-07-25. # More resources * [Online Documentation](https://docs.python.org/3.11/) * [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different The Planck temperature is 1.416784×10**32 K. At this temperature, the wavelength of light emitted by thermal radiation reaches the Planck length. There are no known physical models able to describe temperatures greater than the Planck temperature and a quantum theory of gravity would be required to model the extreme energies attained. Hypothetically, a system in thermal equilibrium at the Planck temperature might contain Planck-scale black holes, constantly being formed from thermal radiation and decaying via Hawking evaporation; adding energy to such a system might decrease its temperature by creating larger black holes, whose Hawking temperature is lower. Rumours say the Planck temperature can be reached in some of the hottest parts of Spain in summer. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ If you have any questions, please reach out to me or another member of the release team :) Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASE] The cursed fourth Python 3.11 beta (3.11.0b4) is available
BSD-style checksum format hashes for the release artefacts: SHA256 (python-3.11.0b4-embed-arm64.zip) = 272c6bb4948c597f6578f64c2b15a70466c5dfb49f9b84dba57a84e59e7bd4ef SHA256 (python-3.11.0b4-amd64.exe) = a3514b0401e6a85416f3e080586c86ccd9e2e62c8a54b9119d9e6415e3cadb62 SHA256 (python-3.11.0b4-macos11.pkg) = 860647775d4e6cd1a8d71412233df5dbe3aa2886fc16d82a59ab2f625464f2d7 SHA256 (python-3.11.0b4-embed-win32.zip) = 36b81da7986f8d59be61adb452681dbd3257ebb90bd89092b2fbbd9356e06425 SHA256 (python-3.11.0b4-arm64.exe) = ad0d1429682ba1edc0c0cf87f68a3d1319b887b715da70a91db41d02be4997a4 SHA256 (python-3.11.0b4-embed-amd64.zip) = 66e6bb44c36da36ecc1de64efdb92f52ba3a19221dba2a89e22e39f715bd205b SHA256 (Python-3.11.0b4.tar.xz) = 1d93b611607903e080417c1a9567f5fbbf5124cc5c86f4afbba1c8fd34c5f6fb SHA256 (python-3.11.0b4.exe) = 6febc152711840337f53e2fd5dc12bb2b1314766f591129282fd372c855fa877 SHA256 (Python-3.11.0b4.tgz) = 257e753db2294794fa8dec072c228f3f53fd541a303de9418854b3c2512ccbec -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The last 3.11 beta release (3.11.0b5) is now available
Here we are. The universe. The vastness of spacetime. At the edge. The last
frontier. The last beta*(conditions apply) for Python 3.11.
We have defied the powerful gods of release blockers and we have won by
using the required amount of ruse and subterfuge.
https://www.python.org/downloads/release/python-3110b5/
## :warning: PLEASE HELP US TO TEST THIS RELEASE :warning:
Due to the modified release schedule and the stability concerns regarding
the past beta releases, please, please, please, please, help us to test
Python 3.11 by testing this beta releases.
* if you maintain a library or a third-party package. Test the beta
releases!
* If you have code that you maintain at work/research
centre/classroom/whatever. Test the beta releases!
* If you are a multi-million corporation that uses Python. Test the beta
releases!
* If you are a single-person company that uses Python. Test the beta
releases!
* If you have a bunch of Python scripts. Test the beta releases!
* If you use Python for work, research, teaching or literally for anything.
Test the beta releases!
* If you ...
In summary: no matter who you are of what you do. Test the beta releases!
Is **very** important for us that we identify all possible things that may
break your code **before** the final release is done and we can only do
this if you help us by testing the beta releases and then report anything
that doesn't work!
## This is a beta preview of Python 3.11
Python 3.11 is still in development. 3.11.0b5 is the last of five 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 prepare
their projects to support the new feature release.
We **strongly encourage** maintainers of third-party Python projects to
**test with 3.11** during the beta phase and report issues found to [the
Python bug tracker](https://github.com/python/cpython/issues) as soon as
possible. While the release is planned to be feature complete entering the
beta phase, it is possible that features may be modified or, in rare cases,
deleted up until the start of the release candidate phase (Monday,
2021-08-02). Our goal is have no ABI changes after beta 5 and as few code
changes as possible after 3.11.0rc1, the first release candidate. To
achieve that, it will be **extremely important** to get as much exposure
for 3.11 as possible during the beta phase.
Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.
# Major new features of the 3.11 series, compared to 3.10
Some of the new major new features and changes in Python 3.11 are:
## General changes
* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and except*
* [PEP 680](https://www.python.org/dev/peps/pep-0680/)-- tomllib: Support
for Parsing TOML in the Standard Library
* [PEP 681](https://www.python.org/dev/peps/pep-0681/)-- Data Class
Transforms
* [bpo-46752](https://github.com/python/cpython/issues/90908)-- Introduce
task groups to asyncio
* [bpo-433030](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping ((?>...)) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster Cpython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.
## Typing and typing language changes
* [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/)-- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/)-- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/)-- Marking individual
TypedDict items as required or potentially-missing
(Hey, **fellow core developer,** if a feature you find important is
missing from this list, [let Pablo know](mailto:[email protected]
).)
The next pre-release of Python 3.11 will be 3.11.0rc1, currently scheduled
for Monday, 2022-08-01.
# More resources
* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).
# And now for something completely different
Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after
Albert Einstein and Nathan Rosen), are connections between areas of space
that can be modelled as vacuum solutions to the Einstein field equations,
and that are now understood to be intrinsic parts of the m
[RELEASE] Python 3.10.6 is available
Here you have a nice package of 200 commits of bugfixes and documentation improvements freshly made for Python 3.10. Go and download it when is still hot: https://www.python.org/downloads/release/python-3106/ ## This is the sixth maintenance release of Python 3.10 Python 3.10.6 is the newest major release of the Python programming language, and it contains many new features and optimizations. # Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL 1.1.1 or newer * [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove Py_UNICODE encoder APIs * [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional EncodingWarning [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to be on this list in previous pre-releases but it has been postponed to Python 3.11 due to some compatibility concerns. You can read the Steering Council communication about it [here]( https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/) to learn more. # More resources * [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog ) * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different A pentaquark is a human-made subatomic particle, consisting of four quarks and one antiquark bound together; they are not known to occur naturally or exist outside of experiments to create them. As quarks have a baryon number of (+1/3), and antiquarks of (−1/3), the pentaquark would have a total baryon number of 1 and thus would be a baryon. Further, because it has five quarks instead of the usual three found in regular baryons (a.k.a. 'triquarks'), it is classified as an exotic baryon. The name pentaquark was coined by Claude Gignoux et al. (1987) and Harry J. Lipkin in 1987; however, the possibility of five-quark particles was identified as early as 1964 when Murray Gell-Mann first postulated the existence of quarks. Although predicted for decades, pentaquarks proved surprisingly tricky to discover and some physicists were beginning to suspect that an unknown law of nature prevented their production. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.11 release candidate 1 (3.11.0rc1) is available
Python 3.11.0 is almost ready. This release, 3.11.0rc1, is the penultimate
release preview. You can get it here:
## This is the first release candidate of Python 3.11
https://www.python.org/downloads/release/python-3110rc1/
This release, **3.11.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 Monday, 2022-09-05 while the official release is planned for Monday,
2022-10-03.
There will be no ABI changes from this point forward in the 3.11 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
* Are all your changes properly documented?
* Did you notice other changes you know of to have insufficient
documentation?
Community members
We strongly encourage maintainers of third-party Python projects to prepare
their projects for 3.11 compatibilities during this phase. As always,
report any issues to [the Python bug tracker ](https://github.com/issues).
Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.
# Major new features of the 3.11 series, compared to 3.10
Some of the new major new features and changes in Python 3.11 are:
## General changes
* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and `except*`
* [PEP 680](https://www.python.org/dev/peps/pep-0680/) -- tomllib: Support
for Parsing TOML in the Standard Library
* [gh-90908](https://github.com/python/cpython/issues/90908) -- Introduce
task groups to asyncio
* [gh-34627](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping (`(?>...)`) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster CPython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.
## Typing and typing language changes
* [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) -- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/) -- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) -- Marking
individual TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/) -- Data Class
Transforms
(Hey, **fellow core developer,** if a feature you find important is
missing from this list, [let Pablo know](mailto:[email protected]
).)
The next pre-release of Python 3.11 will be 3.11.0rc2, currently scheduled
for Monday, 2022-09-05.
# More resources
* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).
# And now for something completely different
A quark star is a hypothetical type of compact, exotic star, where
extremely high core temperature and pressure have forced nuclear particles
to form quark matter, a continuous state of matter consisting of free
quarks.
Some massive stars collapse to form neutron stars at the end of their life
cycle, as has been both observed and explained theoretically. Under the
extreme temperatures and pressures inside neutron stars, the neutrons are
normally kept apart by degeneracy pressure, stabilizing the star and
hindering further gravitational collapse. However, it is hypothesized that
under even more extreme temperature and pressure, the degeneracy pressure
of the neutrons is overcome, and the neutrons are forced to merge and
dissolve into their constituent quarks, creating an ultra-dense phase of
quark matter based on densely packed quarks. In this state, a new
equilibrium is supposed to emerge, as a new degeneracy pressure between the
quarks, as well as repulsive electromagnetic forces, will occur and hinder
total gravitational collapse.
If these ideas are correct, quark stars might occur, and be observable,
somewhere in the universe. Theoretically, such a scenario is seen as
scientifically plausible, but it has been impossible to prove both
observationally and experimentally because the very extreme conditions
needed for stabilizing quark matter cannot be created in any laboratory nor
observed directly in nature. The stability of quark matter, and hence the
existence of quark stars, is for th
[RELEASE] Python 3.11 release candidate 2 (3.11.0rc2) is available
Python 3.11 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-3110rc2/
## This is the second release candidate of Python 3.11
This release, **3.11.0rc2**, is the last preview before the final release
of Python 3.11.0 on 2022-10-24.
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 Monday, 2022-09-05 while the official release is
planned for Monday, 2022-10-24.
There will be no ABI changes from this point forward in the 3.11 series and
the goal is that there will be as few code changes as possible.
## Modification of the final release
Due to the fact that we needed to delay the last release candidate by a
week and because of personal scheduling problems I am delaying the final
release to 2022-10-24 (three weeks from the original date).
## Call to action
⚠️⚠️⚠️⚠️⚠️⚠️⚠️
The 3.11 branch is now accepting changes for 3.11.**1**. To maximize
stability, the final release will be cut from the v3.11.0rc2 tag. If you
need the release manager (me) to cherry-pick any critical fixes, mark
issues as release blockers, and/or add me as a reviewer on a critical
backport PR on GitHub. To see which changes are currently cherry-picked for
inclusion in 3.11.0, look at the short-lived branch-v3.11.0
https://github.com/python/cpython/tree/branch-v3.11.0 on GitHub.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️
---
Core developers: all eyes on the docs now
* Are all your changes properly documented?
* Did you notice other changes you know of to have insufficient
documentation?
Community members
We strongly encourage maintainers of third-party Python projects to prepare
their projects for 3.11 compatibilities during this phase. As always,
report any issues to [the Python bug tracker ](https://github.com/issues).
Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.
# Major new features of the 3.11 series, compared to 3.10
Some of the new major new features and changes in Python 3.11 are:
## General changes
* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and `except*`
* [PEP 680](https://www.python.org/dev/peps/pep-0680/) -- tomllib: Support
for Parsing TOML in the Standard Library
* [gh-90908](https://github.com/python/cpython/issues/90908) -- Introduce
task groups to asyncio
* [gh-34627](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping (`(?>...)`) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster CPython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.
## Typing and typing language changes
* [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) -- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/) -- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) -- Marking
individual TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/) -- Data Class
Transforms
(Hey, **fellow core developer,** if a feature you find important is
missing from this list, [let Pablo know](mailto:[email protected]
).)
The next release will be the final release of Python 3.11.0, which is
currently scheduled for Monday, 2022-10-24.
# More resources
* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).
# And now for something completely different
In general relativity, a white hole is a theoretical region of spacetime
and singularity that cannot be entered from the outside, although
energy-matter, light and information can escape from it. In this sense, it
is the reverse of a black hole, which can be entered only from the outside
and from which energy-matter, light and information cannot escape. White
holes appear in the theory of eternal black holes. In addition to a black
hole region in the future, such a solution of the Einstein field equations
has a white h
[RELEASE] Python 3.11 final (3.11.0) is available
Python 3.11 is finally released. In the CPython release team, we have put a
lot of effort into making 3.11 the best version of Python possible. Better
tracebacks, faster Python, exception groups and except*, typing
improvements and much more. Get it here:
https://www.python.org/downloads/release/python-3110/
## This is the stable release of Python 3.11.0
Python 3.11.0 is the newest major release of the Python programming
language, and it contains many new features and optimizations.
# Major new features of the 3.11 series, compared to 3.10
Some of the new major new features and changes in Python 3.11 are:
## General changes
* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and `except*`
* [PEP 680](https://www.python.org/dev/peps/pep-0680/) -- tomllib: Support
for Parsing TOML in the Standard Library
* [gh-90908](https://github.com/python/cpython/issues/90908) -- Introduce
task groups to asyncio
* [gh-34627](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping (`(?>...)`) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster CPython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.
## Typing and typing language changes
* [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) -- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/) -- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) -- Marking
individual TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/) -- Data Class
Transforms
# More resources
* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).
# And now for something completely different
When a spherical non-rotating body of a critical radius collapses under its
own gravitation under general relativity, theory suggests it will collapse
to a single point. This is not the case with a rotating black hole (a Kerr
black hole). With a fluid rotating body, its distribution of mass is not
spherical (it shows an equatorial bulge), and it has angular momentum.
Since a point cannot support rotation or angular momentum in classical
physics (general relativity being a classical theory), the minimal shape of
the singularity that can support these properties is instead a ring with
zero thickness but non-zero radius, and this is referred to as a
ringularity or Kerr singularity.
This kind of singularity has the following peculiar property. The spacetime
allows a geodesic curve (describing the movement of observers and photons
in spacetime) to pass through the center of this ring singularity. The
region beyond permits closed time-like curves. Since the trajectory of
observers and particles in general relativity are described by time-like
curves, it is possible for observers in this region to return to their
past. This interior solution is not likely to be physical and is considered
a purely mathematical artefact.
There are some other interesting free-fall trajectories. For example, there
is a point in the axis of symmetry that has the property that if an
observer is below this point, the pull from the singularity will force the
observer to pass through the middle of the ring singularity to the region
with closed time-like curves and it will experience repulsive gravity that
will push it back to the original region, but then it will experience the
pull from the singularity again and will repeat this process forever. This
is, of course, only if the extreme gravity doesn’t destroy the observer
first.
# We hope you enjoy the new releases!
Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.
https://www.python.org/psf/
If you have any questions, please reach out to me or another member of the
release team :)
Your friendly release team,
Ned Deily @nad https://discuss.python.org/u/nad
Steve Dower @steve.dower https://discuss.python.org/u/steve.dower
Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal
--
https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] Python 3.11.2, 3.10.10
Apologies! It seems that I added python-comitters and python-announce but forgot to add python-dev. Here is the email to python-announce: [1]Mailman 3 [RELEASE] Python 3.11.2, Python 3.10.10 and 3.12.0 alpha 5 are available - [2]favicon.ico Python-announce-list - python.org mail.python.org Apologies for the confusion! Regards from cloudy London, Pablo Galindo Salgado Pablo Galindo Salgado On 18 Feb 2023, at 11:14, אורי wrote: Hi, I was surprised that Python 3.11.2 and 3.10.10 have been released without a notice to this mailing list. What happened? Thanks, Uri. אורי [3][email protected] On Wed, Dec 7, 2022 at 1:03 AM Łukasz Langa <[4][email protected]> wrote: Greetings! We bring you a slew of releases this fine Saint Nicholas / Sinterklaas day. Six simultaneous releases has got to be some record. There’s one more record we broke this time, you’ll see below. In any case, updating is recommended due to security content: 3.7 - 3.12: gh-98739 <[5]https://github.com/python/cpython/issues/98739>: Updated bundled libexpat to 2.5.0 to fix CVE-2022-43680 <[6]https://nvd.nist.gov/vuln/detail/CVE-2022-43680> (heap use-after-free). 3.7 - 3.12: gh-98433 <[7]https://github.com/python/cpython/issues/98433>: The IDNA codec decoder used on DNS hostnames by socket or asyncio related name resolution functions no longer involves a quadratic algorithm to fix CVE-2022-45061 <[8]https://nvd.nist.gov/vuln/detail/CVE-2022-45061>. This prevents a potential CPU denial of service if an out-of-spec excessive length hostname involving bidirectional characters were decoded. Some protocols such as urllib http 3xx redirects potentially allow for an attacker to supply such a name. 3.7 - 3.12: gh-11 <[9]https://github.com/python/cpython/issues/11>: python -m http.server no longer allows terminal control characters sent within a garbage request to be printed to the stderr server log. 3.8 - 3.12: gh-87604 <[10]https://github.com/python/cpython/issues/87604>: Avoid publishing list of active per-interpreter audit hooks via the gc module. 3.9 - 3.10 (already released in 3.11+ before): gh-97514 <[11]https://github.com/python/cpython/issues/97514>: On Linux the multiprocessing module returns to using filesystem backed unix domain sockets for communication with the forkserver process instead of the Linux abstract socket namespace. Only code that chooses to use the “forkserver” start method is affected. This prevents Linux CVE-2022-42919 <[12]https://nvd.nist.gov/vuln/detail/CVE-2022-42919> (potential privilege escalation) as abstract sockets have no permissions and could allow any user on the system in the same network namespace (often the whole system) to inject code into the multiprocessing forkserver process. This was a potential privilege escalation. Filesystem based socket permissions restrict this to the forkserver process user as was the default in Python 3.8 and earlier. 3.7 - 3.10: gh-98517 <[13]https://github.com/python/cpython/issues/98517>: Port XKCP’s fix for the buffer overflows in SHA-3 to fix CVE-2022-37454 <[14]https://nvd.nist.gov/vuln/detail/CVE-2022-37454>. 3.7 - 3.9 (already released in 3.10+ before): gh-68966 <[15]https://github.com/python/cpython/issues/68966>: The deprecated mailcap module now refuses to inject unsafe text (filenames, MIME types, parameters) into shell commands to address CVE-2015-20107 <[16]https://nvd.nist.gov/vuln/detail/CVE-2015-20107>. Instead of using such text, it will warn and act as if a match was not found (or for test commands, as if the test failed). <[17]https://discuss.python.org/t/python-3-11-1-3-10-9-3-9-16-3-8-16-3-7-16-and-3-12-0-alpha-3-are-now-available/21724#python-3120-alpha-3-1>Python 3.12.0 alpha 3 Get it here, read the change log, sing a GPT-3-generated Sinterklaas song: [18]https://www.python.org/downloads/release/python-3120a3/ <[19]https://www.python.org/downloads/release/python-3120a3/> 216 new commits since 3.12.0 alpha 2 last month. <[20]https://discuss.python.org/t/python-3-11-1-3-10-9-3-9-16-3-8-16-3-7-16-and-3-12-0-alpha-3-are-now-available/21724#python-3111-2>Python 3.11.1 Get it here, see the change log, read the recipe for quark soup: [21]https://www.python.org/downloads/release/python-3111/ <[22]https://www.python.org/downloads/release/python-3111/> A whopping 495 new commits since 3.11.0. This is a massive increa
Python 3.10.0a5 is now available
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 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 may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is not recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: - PEP 623 <https://www.python.org/dev/peps/pep-0623/> – Remove wstr from Unicode - PEP 604 <https://www.python.org/dev/peps/pep-0604/> – Allow writing union types as X | Y - PEP 612 <https://www.python.org/dev/peps/pep-0612/> – Parameter Specification Variables - PEP 626 <https://www.python.org/dev/peps/pep-0626/> – Precise line numbers for debugging and other tools. - bpo-38605 <https://bugs.python.org/issue38605>: from __future__ import annotations (PEP 563 <https://www.python.org/dev/peps/pep-0563/>) is now the default. - PEP 618 <https://www.python.org/dev/peps/pep-0618/>– Add Optional Length-Checking To zip. - bpo-12782 <https://bugs.python.org/issue12782>: Parenthesized context managers are now officially allowed. - (Hey, fellow core developer, if a feature you find important is missing from this list, let Pablo know .) The next pre-release of Python 3.10 will be 3.10.0a6, currently scheduled for 2021-03-01. And now for something completely different The Chandrasekhar limit is the maximum mass of a stable white dwarf star. White dwarfs resist gravitational collapse primarily through electron degeneracy pressure, compared to main sequence stars, which resist collapse through thermal pressure. The Chandrasekhar limit is the mass above which electron degeneracy pressure in the star’s core is insufficient to balance the star’s own gravitational self-attraction. Consequently, a white dwarf with a mass greater than the limit is subject to further gravitational collapse, evolving into a different type of stellar remnant, such as a neutron star or black hole. Those with masses up to the limit remain stable as white dwarfs. The currently accepted value of the Chandrasekhar limit is about 1.4 M☉ (2.765×1030 kg). So we can be safe knowing that our sun is not going to become a black hole! Regards from cloudy London, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0a6 is available, now with 100% more pattern matching
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 how we can improve it: What's new: https://docs.python.org/3.10/whatsnew/3.10.html Tutorial: https://docs.python.org/3.10/tutorial/controlflow.html#match-statements Go get the new alpha here: https://www.python.org/downloads/release/python-3100a6/ *Note: The alpha was officially released yesterday, but my email client failed to deliver this email to the mailing lists so I am reposting it.* **This is an early developer preview of Python 3.10** # Major new features of the 3.10 series, compared to 3.9 Python 3.10 is still in development. This release, 3.10.0a6 is the sixth of seven 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 may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is **not** recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Remove wstr from Unicode * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) is now the default. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * (Hey, **fellow core developer,** if a feature you find important is missing from this list, [let Pablo know](mailto:[email protected] ).) The next pre-release of Python 3.10 will be 3.10.0a7 ( last alpha release), currently scheduled for Monday, 2021-04-05. # More resources * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after Albert Einstein and Nathan Rosen), are connections between areas of space that can be modelled as vacuum solutions to the Einstein field equations, and that are now understood to be intrinsic parts of the maximally extended version of the Schwarzschild metric describing an eternal black hole with no charge and no rotation. Here, "maximally extended" refers to the idea that the spacetime should not have any "edges": it should be possible to continue this path arbitrarily far into the particle's future or past for any possible trajectory of a free-falling particle (following a geodesic in the spacetime). Although Schwarzschild wormholes are not traversable in both directions, their existence inspired Kip Thorne to imagine traversable wormholes created by holding the "throat" of a Schwarzschild wormhole open with exotic matter (material that has negative mass/energy). Regards from rainy London, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
Python 3.10.0a6 is available, now with 100% more pattern matching
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 how we can improve it: What's new: https://docs.python.org/3.10/whatsnew/3.10.html Tutorial: https://docs.python.org/3.10/tutorial/controlflow.html#match-statements Go get the new alpha here: https://www.python.org/downloads/release/python-3100a6/ **This is an early developer preview of Python 3.10** # Major new features of the 3.10 series, compared to 3.9 Python 3.10 is still in development. This release, 3.10.0a6 is the sixth of seven 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 may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is **not** recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Remove wstr from Unicode * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) is now the default. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * (Hey, **fellow core developer,** if a feature you find important is missing from this list, [let Pablo know](mailto:[email protected] ).) The next pre-release of Python 3.10 will be 3.10.0a7 ( last alpha release), currently scheduled for Monday, 2021-04-05. # More resources * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different Schwarzschild wormholes, also known as Einstein–Rosen bridges (named after Albert Einstein and Nathan Rosen), are connections between areas of space that can be modelled as vacuum solutions to the Einstein field equations, and that are now understood to be intrinsic parts of the maximally extended version of the Schwarzschild metric describing an eternal black hole with no charge and no rotation. Here, "maximally extended" refers to the idea that the spacetime should not have any "edges": it should be possible to continue this path arbitrarily far into the particle's future or past for any possible trajectory of a free-falling particle (following a geodesic in the spacetime). Although Schwarzschild wormholes are not traversable in both directions, their existence inspired Kip Thorne to imagine traversable wormholes created by holding the "throat" of a Schwarzschild wormhole open with exotic matter (material that has negative mass/energy). Regards from rainy London, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The last Python 3.10 alpha (3.10.0a7) is available - Prepare for beta freeze
Br. 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 specially mindfully to check the CI and the buildbots, maybe even using the test-with-buildbots label in GitHub before merging so the release team don’t need to fix a bunch of reference leaks or platform-specific problems on the first beta release. *Go get the new alpha here:* https://www.python.org/downloads/release/python-3100a7/ *Python 3.10.0a7*Release Date: April 5, 2021 This is an early developer preview of Python 3.10 *Major new features of the 3.10 series, compared to 3.9* Python 3.10 is still in development. This release, 3.10.0a7 is the last of seven 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 may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is not recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: PEP 623 – Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. PEP 604 – Allow writing union types as X | Y PEP 612 – Parameter Specification Variables PEP 626 – Precise line numbers for debugging and other tools. bpo-38605: from __future__ import annotations (PEP 563) is now the default. PEP 618 – Add Optional Length-Checking To zip. bpo-12782: Parenthesized context managers are now officially allowed. PEP 632 – Deprecate distutils module. PEP 613 – Explicit Type Aliases PEP 634 – Structural Pattern Matching: Specification PEP 635 – Structural Pattern Matching: Motivation and Rationale PEP 636 – Structural Pattern Matching: Tutorial PEP 644 – Require OpenSSL 1.1.1 or newer PEP 624 – Remove Py_UNICODE encoder APIs PEP 597 – Add optional EncodingWarning (Hey, fellow core developer, if a feature you find important is missing from this list, let Pablo know.) The next pre-release of Python 3.10 will be 3.10.0b1 ( the first beta release and feature freeze ), currently scheduled for Monday, 2021-05-03. *And now for something completely different* In physics, the twin paradox is a thought experiment in special relativity involving identical twins, one of whom makes a journey into space in a high-speed rocket and returns home to find that the twin who remained on Earth has aged more. This result appears puzzling because each twin sees the other twin as moving, and so, as a consequence of an incorrect and naive application of time dilation and the principle of relativity, each should paradoxically find the other to have aged less. However, this scenario can be resolved by realising that the travelling twin is undergoing acceleration, which makes him a non-inertial observer. In both views, there is no symmetry between the spacetime paths of the twins. Therefore, the twin paradox is not a paradox in the sense of a logical contradiction. Your friendly release team, Pablo Galindo Salgado @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0b2 is available
After fighting with some release blockers, implementing a bunch of GC traversal functions, and fixing some pending reference leaks, we finally have Python 3.10.0 beta 2 ready for you! Thanks to everyone that helped to unblock the release! https://www.python.org/downloads/release/python-3100b2/ # This is a beta preview of Python 3.10 Python 3.10 is still in development. 3.10.0b2 is the second of four planned beta release previews. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to prepare their projects to support the new feature release. We **strongly encourage** maintainers of third-party Python projects to **test with 3.10** during the beta phase and report issues found to [the Python bug tracker](https://bugs.python.org/) as soon as possible. While the release is planned to be feature complete entering the beta phase, it is possible that features may be modified or, in rare cases, deleted up until the start of the release candidate phase (Monday, 2021-08-02). Our goal is to have no ABI changes after beta 4 and as few code changes as possible after 3.10.0rc1, the first release candidate. To achieve that, it will be **extremely important** to get as much exposure for 3.10 as possible during the beta phase. Please keep in mind that this is a preview release and its use is **not** recommended for production environments. The next pre-release of Python 3.10 will be 3.10.0b3, currently scheduled for Thursday, 2021-06-17. # And now for something completely different The Ehrenfest paradox concerns the rotation of a "rigid" disc in the theory of relativity. In its original 1909 formulation as presented by Paul Ehrenfest in relation to the concept of Born rigidity within special relativity, it discusses an ideally rigid cylinder that is made to rotate about its axis of symmetry. The radius R as seen in the laboratory frame is always perpendicular to its motion and should therefore be equal to its value R0 when stationary. However, the circumference (2πR) should appear Lorentz-contracted to a smaller value than at rest. This leads to the apparent contradiction that R = R0 and R < R0. # We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from very sunny London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0b3 is available
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. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to prepare their projects to support the new feature release. We strongly encourage maintainers of third-party Python projects to test with 3.10 during the beta phase and report issues found to the Python bug tracker as soon as possible. While the release is planned to be feature complete entering the beta phase, it is possible that features may be modified or, in rare cases, deleted up until the start of the release candidate phase (Monday, 2021-08-02). Our goal is to have no ABI changes after beta 4 and as few code changes as possible after 3.10.0rc1, the first release candidate. To achieve that, it will be extremely important to get as much exposure for 3.10 as possible during the beta phase. Please keep in mind that this is a preview release and its use is not recommended for production environments. The next pre-release of Python 3.10 will be 3.10.0b4, currently scheduled for Saturday, 2021-07-10. #And now for something completely different There are no green stars. Why? In general, objects don’t emit a single wavelength of light when they shine. Instead, they emit photons in a range of wavelengths. If you were to use some sort of detector that is sensitive to the wavelengths of light emitted by an object, and then plotted the number of them versus wavelength, you get a lopsided plot called a blackbody curve. For an object as hot as the Sun, that curve peaks at blue-green, so it emits most of its photons there. But it still emits some that are bluer, and some that are redder. When we look at the Sun, we see all these colors blended together. Our eyes mix them up to produce one color: white. A warmer star will put out more blue, and a cooler one redder, but no matter what, our eyes just won’t see that as green. Due to how we perceive color, the only way to see a star as being green is for it to be only emitting green light. But as starts always emit radiation following the blackbody curve, that’s pretty much impossible. # We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from very cloudy London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0b4 is available
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.0b4 is the fourth and last of the beta release previews. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to prepare their projects to support the new feature release. We strongly encourage maintainers of third-party Python projects to test with 3.10 during the beta phase and report issues found to the Python bug tracker as soon as possible. While the release is planned to be feature complete entering the beta phase, it is possible that features may be modified or, in rare cases, deleted up until the start of the release candidate phase (Monday, 2021-08-02). Our goal is to have no ABI changes after beta 4 and as few code changes as possible after 3.10.0rc1, the first release candidate. To achieve that, it will be extremely important to get as much exposure for 3.10 as possible during the beta phase. Please keep in mind that this is a preview release and its use is not recommended for production environments. The next pre-release, the first release candidate of Python 3.10.0, will be 3.10.0rc1. It is currently scheduled for Monday, 2021-08-02. #And now for something completely different In quantum physics, the spin is an intrinsic form of angular momentum carried by elementary particles, composite particles, and atomic nuclei. The spin is one of two types of angular momentum in quantum mechanics, the other being orbital angular momentum. The orbital angular momentum operator is the quantum-mechanical counterpart to the classical angular momentum of orbital revolution and appears when there is periodic structure to its wavefunction as the angle varies. For photons, spin is the quantum-mechanical counterpart of the polarization of light; for electrons, the spin has no classical counterpart. # We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from very cloudy London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0rc1 is available
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 - Are all your changes properly documented? - Did you notice other changes you know of to have insufficient documentation? Community members We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.10 compatibilities during this phase. As always, report any issues to the Python bug tracker <https://bugs.python.org/>. Please keep in mind that this is a preview release and its use is **not** recommended for production environments. *And now for something completely different* In theoretical physics, quantum chromodynamics (QCD) is the theory of the strong interaction between quarks and gluons, the fundamental particles that make up composite hadrons such as the proton, neutron, and pion. The QCD analog of electric charge is a property called color. Gluons are the force carrier of the theory, just as photons are for the electromagnetic force in quantum electrodynamics. There are three kinds of charge in QCD (as opposed to one in quantum electrodynamics or QED) that are usually referred to as "color charge" by loose analogy to the three kinds of color (red, green and blue) perceived by humans. Other than this nomenclature, the quantum parameter "color" is completely unrelated to the everyday, familiar phenomenon of color. *We hope you enjoy those new releases!* Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from cloudy London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
Re: [RELEASE] Python 3.10.0rc1 is available
Hi, Unfortunately, due to a problem that I was not aware of caused by https://bugs.python.org/issue44756, the release artifacts for Linux contained a "venv" folder in the "Docs" directory. I have uploaded a new version of the artifacts that fixed this problem and I have corrected this for future releases. If you had any problem building docs with the previous release artifacts for 3.10.0rc1, please try again. Regards from cloudy London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower On Tue, 3 Aug 2021 at 17:31, Pablo Galindo Salgado wrote: > 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 > >- Are all your changes properly documented? >- Did you notice other changes you know of to have insufficient >documentation? > > Community members > > We strongly encourage maintainers of third-party Python projects to > prepare their projects for 3.10 compatibilities during this phase. As > always, report any issues to the Python bug tracker > <https://bugs.python.org/>. > Please keep in mind that this is a preview release and its use is **not** > recommended for production environments. > > *And now for something completely different* > > In theoretical physics, quantum chromodynamics (QCD) is the theory of the > strong interaction between quarks and gluons, the fundamental particles > that make up composite hadrons such as the proton, neutron, and pion. The > QCD analog of electric charge is a property called color. Gluons are the > force carrier of the theory, just as photons are for the electromagnetic > force in quantum electrodynamics. There are three kinds of charge in QCD > (as opposed to one in quantum electrodynamics or QED) that are usually > referred to as "color charge" by loose analogy to the three kinds of color > (red, green and blue) perceived by humans. Other than this nomenclature, > the quantum parameter "color" is completely unrelated to the everyday, > familiar phenomenon of color. > > > *We hope you enjoy those new releases!* > Thanks to all of the many volunteers who help make Python Development and > these releases possible! Please consider supporting our efforts by > volunteering yourself or through organization contributions to the Python > Software Foundation. > > Regards from cloudy London, > > Your friendly release team, > Pablo Galindo @pablogsal > Ned Deily @nad > Steve Dower @steve.dower > -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0rc2 is available
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.**1*. To maximize stability, the final release will be cut from the v3.10.0rc2 tag. If you need the release manager (me) to cherry-pick any critical fixes, mark issues as release blockers, and/or add me as a reviewer on a critical backport PR on GitHub. To see which changes are currently cherry-picked for inclusion in 3.10.0, look at the short-lived branch-v3.10.0 https://github.com/python/cpython/tree/branch-v3.10.0 on GitHub. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️ *Core developers: all eyes on the docs now* - Are all your changes properly documented? - Did you notice other changes you know of to have insufficient documentation? *Community members* We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.10 compatibilities during this phase. As always, report any issues to [the Python bug tracker ](https://bugs.python.org/). Please keep in mind that this is a preview release and its use is **not** recommended for production environments. And now for something completely different Maxwell's demon is a thought experiment that would hypothetically violate the second law of thermodynamics. It was proposed by the physicist James Clerk Maxwell in 1867. In the thought experiment, a demon controls a small massless door between two chambers of gas. As individual gas molecules (or atoms) approach the door, the demon quickly opens and closes the door to allow only fast-moving molecules to pass through in one direction, and only slow-moving molecules to pass through in the other. Because the kinetic temperature of a gas depends on the velocities of its constituent molecules, the demon's actions cause one chamber to warm up and the other to cool down. This would decrease the total entropy of the two gases, without applying any work, thereby violating the second law of thermodynamics. We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from a plane going to Malaga, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0 is available
On behalf of the Python development community and the Python 3.10 release team, I’m pleased to announce the availability of Python 3.10.0. Python 3.10.0 is the newest major release of the Python programming language, and it contains many new features and optimizations. https://www.python.org/downloads/release/python-3100/ # Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL 1.1.1 or newer * [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove Py_UNICODE encoder APIs * [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional EncodingWarning [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to be on this list in previous pre-releases but it has been postponed to Python 3.11 due to some compatibility concerns. You can read the Steering Council communication about it [here]( https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/) to learn more. # More resources * [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog ) * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different For a Schwarzschild black hole (a black hole with no rotation or electromagnetic charge), given a free fall particle starting at the event horizon, the maximum propper time it will experience to fall into (which happens when it falls without angular velocity) the singularity is `π*M` (in [natural units](https://en.wikipedia.org/wiki/Natural_units)), where M is the mass of the black hole. For Sagittarius A* (the black hole at the center of the milky way) this time is approximately 1 minute. Schwarzschild black holes are also unique because they have a space-like singularity at their core, which means that the singularity doesn't happen at a specific point in *space* but happens at a specific point in *time* (the future). This means once you are inside the event horizon you cannot point with your finger towards the direction the singularity is located because the singularity happens in your future: no matter where you move, you will "fall" into it. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ # More resources Online Documentation https://docs.python.org/3.10/ PEP 619 https://www.python.org/dev/peps/pep-0619/, 3.10 Release Schedule Report bugs at https://bugs.python.org https://bugs.python.org/. Help fund Python and its community https://www.python.org/psf/donations/. Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.11.0a1 is available
Now that we are on a release spree, here you have the first alpha release of Python 3.11: Python 3.11.0a1. Let the testing and validation games begin! https://www.python.org/downloads/release/python-3110a1/ *Major new features of the 3.11 series, compared with 3.10* Python 3.11 is still in development. This release, 3.11.0a1 is the first 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 may be added up until the start of the beta phase (2022-05-06) and, if necessary, may be modified or deleted up until the release candidate phase (2022-08-01). Please keep in mind that this is a preview release and its use is not recommended for production environments. Many new features for Python 3.11 are still being planned and written. Among the new major new features and changes so far: - PEP 657 <https://www.python.org/dev/peps/pep-0657/> – Include Fine-Grained Error Locations in Tracebacks - PEP 654 <https://www.python.org/dev/peps/pep-0654/> – PEP 654 – Exception Groups and except* - (Hey, fellow core developer, if a feature you find important is missing from this list, let Pablo know .) The next pre-release of Python 3.11 will be 3.11.0a2, currently scheduled for 2021-11-02. *And now for something completely different* Zero-point energy is the lowest possible energy that a quantum mechanical system may have. Unlike in classical mechanics, quantum systems constantly fluctuate in their lowest energy state as described by the Heisenberg uncertainty principle. As well as atoms and molecules, the empty space of the vacuum has these properties. According to quantum field theory, the universe can be thought of not as isolated particles but as continuous fluctuating fields: matter fields, whose quanta are fermions (i.e., leptons and quarks), and force fields, whose quanta are bosons (e.g., photons and gluons). All these fields have a non zero amount of energy called zero-point energy. Physics currently lacks a full theoretical model for understanding zero-point energy; in particular, the discrepancy between theorized and observed vacuum energy is a source of major contention *We hope you enjoy those new releases!* Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from cloudy London, Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.1 is available
I hope you like bug fixes, because we have a whole shipment of them! Python 3.10.1 is the first maintenance release of Python 3.10 as we have packed more than 330 commits of fixes and general improvements. You can get it here: https://www.python.org/downloads/release/python-3101/ # This is the first maintenance release of Python 3.10 Python 3.10.1 is the newest major release of the Python programming language, and it contains many new features and optimizations. # Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL 1.1.1 or newer * [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove Py_UNICODE encoder APIs * [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional EncodingWarning [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to be on this list in previous pre-releases but it has been postponed to Python 3.11 due to some compatibility concerns. You can read the Steering Council communication about it [here]( https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/) to learn more. # More resources * [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog ) * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different The Meissner effect (or Meissner–Ochsenfeld effect) is the expulsion of a magnetic field from a superconductor during its transition to the superconducting state when it is cooled below the critical temperature. This expulsion will repel a nearby magnet. The German physicists Walther Meissner and Robert Ochsenfeld discovered this phenomenon in 1933 by measuring the magnetic field distribution outside superconducting tin and lead samples. The experiment demonstrated for the first time that superconductors were more than just perfect conductors and provided a uniquely defining property of the superconductor state. The ability for the expulsion effect is determined by the nature of equilibrium formed by the neutralization within the unit cell of a superconductor. You can do [ver cool things](https://www.youtube.com/watch?v=HRLvVkkq5GE) with it! # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.11.0a3 is available
You can tell that we are slowly getting closer to the first beta as the number of release blockers that we need to fix on every release starts to increase [image: :sweat_smile:] But we did it! Thanks to Steve Dower, Ned Deily, Christian Heimes, Łukasz Langa and Mark Shannon that helped get things ready for this release :) Go get the new version here: https://www.python.org/downloads/release/python-3110a3/ **This is an early developer preview of Python 3.11** # Major new features of the 3.11 series, compared to 3.10 Python 3.11 is still in development. This release, 3.11.0a3 is the third of seven 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 may be added up until the start of the beta phase (2022-05-06) and, if necessary, may be modified or deleted up until the release candidate phase (2022-08-01). Please keep in mind that this is a preview release and its use is **not** recommended for production environments. Many new features for Python 3.11 are still being planned and written. Among the new major new features and changes so far: * [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include Fine-Grained Error Locations in Tracebacks * [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups and except* * The [Faster Cpython Project](https://github.com/faster-cpython) is already yielding some exciting results: this version of CPython 3.11 is ~12% faster on the geometric mean of the [PyPerformance benchmarks]( speed.python.org), compared to 3.10.0. * Hey, **fellow core developer,** if a feature you find important is missing from this list, let me know. The next pre-release of Python 3.11 will be 3.11.0a4, currently scheduled for Monday, 2022-01-03. # More resources * [Online Documentation](https://docs.python.org/3.11/) * [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different Rayleigh scattering, named after the nineteenth-century British physicist Lord Rayleigh is the predominantly elastic scattering of light or other electromagnetic radiation by particles much smaller than the wavelength of the radiation. For light frequencies well below the resonance frequency of the scattering particle, the amount of scattering is inversely proportional to the fourth power of the wavelength. Rayleigh scattering results from the electric polarizability of the particles. The oscillating electric field of a light wave acts on the charges within a particle, causing them to move at the same frequency. The particle, therefore, becomes a small radiating dipole whose radiation we see as scattered light. The particles may be individual atoms or molecules; it can occur when light travels through transparent solids and liquids but is most prominently seen in gases. The strong wavelength dependence of the scattering means that shorter (blue) wavelengths are scattered more strongly than longer (red) wavelengths. This results in the indirect blue light coming from all regions of the sky. # We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] The last Python 3.11 alpha (3.11.0a7) is available - Prepare for beta freeze
Br. do you feel that? That's the chill of *beta freeze* coming closer. Meanwhile, your friendly CPython release team doesn’t rest and we have prepared a shiny new release for you: Python 3.11.0a7. Dear fellow core developer: This alpha is the last release before feature freeze (Friday, 2022-05-06), so make sure that all new features and PEPs are landed in the master branch before we release the first beta. Please, be specially mindfully to check the CI and the buildbots, maybe even using the test-with-buildbots label in GitHub before merging so the release team don’t need to fix a bunch of reference leaks or platform-specific problems on the first beta release. *Go get the new alpha here:* https://www.python.org/downloads/release/python-3110a7/ **This is an early developer preview of Python 3.11** # Major new features of the 3.11 series, compared to 3.10 Python 3.11 is still in development. This release, 3.11.0a7 is the last of seven 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 may be added up until the start of the beta phase (2022-05-06) and, if necessary, may be modified or deleted up until the release candidate phase (2022-08-01). Please keep in mind that this is a preview release and its use is **not** recommended for production environments. Many new features for Python 3.11 are still being planned and written. Among the new major new features and changes so far: * [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include Fine-Grained Error Locations in Tracebacks * [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups and except* * [PEP 673](https://www.python.org/dev/peps/pep-0673/) -- Self Type * [PEP 646](https://www.python.org/dev/peps/pep-0646/)-- Variadic Generics * [PEP 680](https://www.python.org/dev/peps/pep-0680/)-- tomllib: Support for Parsing TOML in the Standard Library * [PEP 675](https://www.python.org/dev/peps/pep-0675/)-- Arbitrary Literal String Type * [PEP 655](https://www.python.org/dev/peps/pep-0655/)-- Marking individual TypedDict items as required or potentially-missing * [bpo-46752](https://bugs.python.org/issue46752)-- Introduce task groups to asyncio * The [Faster Cpython Project](https://github.com/faster-cpython) is already yielding some exciting results: this version of CPython 3.11 is ~12% faster on the geometric mean of the [PyPerformance benchmarks]( speed.python.org), compared to 3.10.0. * Hey, **fellow core developer,** if a feature you find important is missing from this list, let me know. The next pre-release of Python 3.11 will be 3.11.0b1, currently scheduled for Friday, 2022-05-06. # More resources * [Online Documentation](https://docs.python.org/3.11/) * [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different In mathematics, the Dirac delta distribution (δ distribution) is a generalized function or distribution over the real numbers, whose value is zero everywhere except at zero, and whose integral over the entire real line is equal to one. The current understanding of the impulse is as a linear functional that maps every continuous function to its value at zero. The delta function was introduced by physicist Paul Dirac as a tool for the normalization of state vectors. It also has uses in probability theory and signal processing. Its validity was disputed until Laurent Schwartz developed the theory of distributions where it is defined as a linear form acting on functions. Defining this distribution as a "function" as many physicist do is known to be one of the easier ways to annoy mathematicians :) # We hope you enjoy those new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Your friendly release team, Pablo Galindo @pablogsal Ned Deily @nad Steve Dower @steve.dower -- https://mail.python.org/mailman/listinfo/python-list
Fwd: [RELEASE] Python 3.10.0a2 available for testing
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 may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is not recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: PEP 623 -- Remove wstr from Unicode PEP 604 -- Allow writing union types as X | Y PEP 612 -- Parameter Specification Variables PEP 626 -- Precise line numbers for debugging and other tools. (Hey, fellow core developer, if a feature you find important is missing from this list, let Pablo know.) The next pre-release of Python 3.10 will be 3.10.0a3, currently scheduled for 2020-12-07. *And now for something completely different * The cardinality (the number of elements) of infinite sets can be one of the most surprising results of set theory. For example, there are the same amount of even natural numbers than natural numbers (which can be even or odd). There is also the same amount of rational numbers than natural numbers. But on the other hand, there are more real numbers between 0 and 1 than natural numbers! All these sets have infinite cardinality but turn out that some of these infinities are bigger than others. These infinite cardinalities normally are represented using aleph numbers. Infinite sets are strange beasts indeed. Regards from cold London, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.9.1 is now available, together with 3.10.0a3 and 3.8.7rc1
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** planned for Monday, 2021-02-08. Python 3.10a3 is the third alpha release of Python 3.10. You can get it here: https://www.python.org/downloads/release/python-3100a3/ Python 3.10a3 is the release preview of the next maintenance release of Python 3.8. You can get it here: https://www.python.org/downloads/release/python-387rc1/ Assuming no critical problems are found prior to **2020-12-21** , the currently scheduled release date for **3.8.7** , 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.8.7 and as such its main purpose is testing. Your friendly release team, Ned Deily, Steve Dower, Pablo Galindo, Łukasz Langa -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.0a4 is now available
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 and bug fixes and to test the release process. During the alpha phase, features may be added up until the start of the beta phase (2021-05-03) and, if necessary, may be modified or deleted up until the release candidate phase (2021-10-04). Please keep in mind that this is a preview release and its use is not recommended for production environments. Many new features for Python 3.10 are still being planned and written. Among the new major new features and changes so far: * PEP 623 – Remove wstr from Unicode * PEP 604 – Allow writing union types as X | Y * PEP 612 – Parameter Specification Variables * PEP 626 – Precise line numbers for debugging and other tools. * bpo-38605: from __future__ import annotations (PEP 563) is now the default. * PEP 618 – Add Optional Length-Checking To zip. (Hey, fellow core developer, if a feature you find important is missing from this list, let me know.) The next pre-release of Python 3.10 will be 3.10.0a5, currently scheduled for 2021-02-01. *And now for something completely different* The Majumdar–Papapetrou spacetime <https://en.wikipedia.org/wiki/Sudhansu_Datta_Majumdar#Majumdar%E2%80%93Papapetrou_solution> is one surprising solution of the coupled Einstein-Maxwell equations that describe a cluster of static charged black holes with the gravitational and the electrostatic forces cancelling each other out. Each one of these many black holes of the multi-black holes system has a spherical topology and follows the Reissner–Nordström metric <https://en.wikipedia.org/wiki/Reissner%E2%80%93Nordstr%C3%B6m_metric>. Unsurprisingly, the movement of a test particle in such spacetime is not only a very chaotic system but also has some fractals <https://arxiv.org/abs/gr-qc/9502014> hiding the complexity of its movement. Regards from cold London, Pablo Galindo Salgado -- https://mail.python.org/mailman/listinfo/python-list
fun with lambdas
Hello!
given the definition
def f(a,b): return a+b
With this code:
fs = [ lambda x: f(x,o) for o in [0,1,2]]
or this
fs = []
for o in [0,1,2]:
fs.append( lambda x: f(x,o) )
I'd expect that fs contains partial evaluated functions, i.e.
fs[0](0) == 0
fs[1](0) == 1
fs[2](0) == 2
But this is not the case :(
What is happening here?
Nevertheless, this code does work
fs = [ eval("lambda x: f(x,%d)" % o) for o in [0,1,2,3]]
Thanks.
Juan Pablo
--
http://mail.python.org/mailman/listinfo/python-list
Re: fun with lambdas
Thanks to all I settled with this: def partial1(f,b): return lambda a:f(a,b) def partial2(f,a): return lambda b:f(a,b) Juan Pablo 2005/10/20, Mike Meyer <[EMAIL PROTECTED]>: > Robert Kern <[EMAIL PROTECTED]> writes: > > Juan Pablo Romero wrote: > >> Hello! > >> > >> given the definition > >> > >> def f(a,b): return a+b > >> > >> With this code: > >> > >> fs = [ lambda x: f(x,o) for o in [0,1,2]] > >> > >> or this > >> > >> fs = [] > >> for o in [0,1,2]: > >> fs.append( lambda x: f(x,o) ) > >> > >> I'd expect that fs contains partial evaluated functions, i.e. > >> > >> fs[0](0) == 0 > >> fs[1](0) == 1 > >> fs[2](0) == 2 > >> > >> But this is not the case :( > >> > >> What is happening here? > > > > Namespaces. The functions are looking up o at runtime. In both cases, o > > is bound to the last object in [0,1,2] once the iteration is finished. > > > > Try this (although I'm sure there are better ways): > > > > In [4]: fs = [lambda x, o=o: f(x, o) for o in [0,1,2]] > > > > In [5]: fs[0](0) > > Out[5]: 0 > > > > In [6]: fs[0](1) > > Out[6]: 1 > > > > In [7]: fs[0](2) > > Out[7]: 2 > > Right explanation. Right solution. Wrong examples. He wanted to see: > > >>> fs[0](0) > 0 > >>> fs[1](0) > 1 > >>> fs[2](0) > 2 > >>> > > List comprehensions were purposely designed to mimic for loops, which > (unlike other languages) don't create a new variable for each pass > through the loop. ((They also "leak" the variable to the surrounding > namespace.) So you need to capture the current value of the loop index > somewhere. An alternative (and maybe slightly cleaner) method is: > > >>> def makef(a): > ... return lambda b: a + b > ... > >>> fs = [makef(o) for o in [0, 1, 2]] > >>> fs[0](0) > 0 > >>> fs[1](0) > 1 > >>> fs[2](0) > 2 > >>> > > Generator comprehensions have the same issue: > > >>> fs = list(lambda x: f(o, x) for o in [0, 1, 2]) > >>> fs[0](0) > 2 > >>> fs[1](0) > 2 > >>> fs[2](0) > 2 > >>> > >-- > Mike Meyer <[EMAIL PROTECTED]> > http://www.mired.org/home/mwm/ > Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Glade Survey
Hello everybody! We (Glade Developers) are conducting a user survey which will help us take informed decisions to improve the overall developer experience. So please take a few minutes to complete the survey, we appreciate it! https://glade.gnome.org/registration.html Cheers Juan Pablo, on behalf of the Glade team What is Glade? Glade is a RAD tool to enable quick & easy development of user interfaces for the GTK+ [1] toolkit and the GNOME [2] desktop environment. The user interfaces designed in Glade are saved as XML, and by using the GtkBuilder [3] GTK+ object these can be loaded by applications dynamically as needed. By using GtkBuilder, Glade XML files can be used in numerous programming languages [4] including C, C++, C#, Vala, Java, Perl, Python,and others. Glade is Free Software released under the GNU GPL License [5] [1] http://www.gtk.org/ [2] http://www.gnome.org/ [3] http://library.gnome.org/devel/gtk/stable/GtkBuilder.html [4] http://www.gtk.org/language-bindings.php [5] http://www.fsf.org/licensing/licenses/gpl.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Glade Survey
On Mon, 2013-11-18 at 16:04 -0500, Gene Heskett wrote: > On Monday 18 November 2013 16:04:14 Juan Pablo Ugarte did opine: > > > Hello everybody! > > > > We (Glade Developers) are conducting a user survey which will help us > > take informed decisions to improve the overall developer experience. > > > > So please take a few minutes to complete the survey, we appreciate it! > > > > https://glade.gnome.org/registration.html > > Your certificate for https is invalid. So I won't. I do not have control over the web server at gnome, I only have access to glade.gnome.org It is true that it is not supplying owner information I guess it should say GNOME Foundation, in any case gnome.org has they same problem so I will contact the web administrators to notify them about the situation. thanks Juan Pablo -- https://mail.python.org/mailman/listinfo/python-list
Re: Glade Survey
On Mon, 2013-11-18 at 21:12 -0500, Gene Heskett wrote: [...] > > Invalid in what way? It looks fine to me. Or is it that you don't > > trust its signer? > > > > ChrisA > > Firefox barked at me. So I backed away. And now it works. Phase of moon > sensitive? Chew in wrong side of mouth? Or you fixed it. :) :) I did not fix anything, do you remember the exact warning? cheers JP -- https://mail.python.org/mailman/listinfo/python-list
Reading csv files using SQL
Hi, exists a Python library that allows to interface to csv files as if you manage a database, using SQL language? Something like csvjdbc in Java, where table name is file name and the field's names are in first row. Thanks! Paolo -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading csv files using SQL
Hi, Dennis Lee Bieber ha scritto: > You could maybe use SQLite to load the CSV file and process in an > actual DBMS... Ok, this is the solution I'm using actually (with PostGres). My hope is to find a way to do the same thing without using a DBMS but working directly with the files. Thanks a lot, Paolo -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading csv files using SQL
Paul McGuire ha scritto: > Sqlite has an in-memory option, so that you can read in your csv, then > load into actual tables. Thanks, this could be the perfect solution. Paolo -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading csv files using SQL
[EMAIL PROTECTED] ha scritto: > If you want to work directly with the files why not just use Python's csv > module? Now, with Java, I use the same class to read several databases and csv files (with SQL instructions). I'd like to find a library for using the same approach in Python. Thank you, Paolo -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading csv files using SQL
Tim Golden ha scritto: > I vaguely remember that you can get an ODBC driver for CSV. There is a standard ODBC driver for use text file or csv, in windows. But I use Linux on production servers. I'd like to find a Python library or tool. Thanks! Paolo -- http://mail.python.org/mailman/listinfo/python-list
Replacing a package with another
Hello, Is it possible to replace one package with another at runtime, that is, I have package a.blah which I want instead of b.blah, so I can "inject" functionality in an existing package? Thanks. -- J. Pablo Fernández <[EMAIL PROTECTED]> (http://pupeno.com) -- http://mail.python.org/mailman/listinfo/python-list
ElementTree and DTDs
Hello, Is ElementTree supposed to load DTDs? I have some xmls heavy on entities and it fails this way: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> filename = "revo/xml/a.xml" >>> import xml.etree.ElementTree as ET >>> ET.parse(filename) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 862, in parse tree.parse(source, parser) File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 586, in parse parser.feed(data) File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1245, in feed self._parser.Parse(data, 0) File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1201, in _default self._parser.ErrorColumnNumber) xml.parsers.expat.ExpatError: undefined entity ĵ: line 13, column 10 >>> import xml.etree.cElementTree as ET >>> ET.parse(filename) Traceback (most recent call last): File "", line 1, in File "", line 45, in parse File "", line 32, in parse SyntaxError: undefined entity &c_j;: line 46, column 17 Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: ElementTree and DTDs
Or is there another library that would handle DTDs correctly, performing entity replacements? Thanks. On May 16, 12:20 am, J. Pablo Fernández <[EMAIL PROTECTED]> wrote: > Hello, > > Is ElementTree supposed to load DTDs? I have some xmls heavy on > entities and it fails this way: > > Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > filename = "revo/xml/a.xml" > >>> import xml.etree.ElementTree as ET > >>> ET.parse(filename) > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 862, in > parse > tree.parse(source, parser) > File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 586, in > parse > parser.feed(data) > File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1245, in > feed > self._parser.Parse(data, 0) > File "/usr/lib/python2.5/xml/etree/ElementTree.py", line 1201, in > _default > self._parser.ErrorColumnNumber) > xml.parsers.expat.ExpatError: undefined entity ĵ: line 13, > column 10>>> import xml.etree.cElementTree as ET > >>> ET.parse(filename) > > Traceback (most recent call last): > File "", line 1, in > File "", line 45, in parse > File "", line 32, in parse > SyntaxError: undefined entity &c_j;: line 46, column 17 > > Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Getting elements and text with lxml
Hello,
I have an XML file that starts with:
*-a
out of it, I'd like to extract something like (I'm just showing one
structure, any structure as long as all data is there is fine):
[("ofc", "*"), "-", ("rad", "a")]
How can I do it? I managed to get the content of boths tags and the
text up to the first tag ("\n "), but not the - (and in other XML
files, there's more text outside the elements).
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Getting elements and text with lxml
On May 17, 2:19 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Fri, 16 May 2008 18:53:03 -0300, J. Pablo Fernández <[EMAIL PROTECTED]>
> escribió:
>
>
>
> > Hello,
>
> > I have an XML file that starts with:
>
> >
> >
> >
> > *-a
> >
>
> > out of it, I'd like to extract something like (I'm just showing one
> > structure, any structure as long as all data is there is fine):
>
> > [("ofc", "*"), "-", ("rad", "a")]
>
> > How can I do it? I managed to get the content of boths tags and the
> > text up to the first tag ("\n "), but not the - (and in other XML
> > files, there's more text outside the elements).
>
> Look for the "tail" attribute.
That gives me the last part, but not the one in the middle:
In : etree.tounicode(e)
Out: u'\n *-a\n\n'
In : e.text
Out: '\n '
In : e.tail
Out: '\n'
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
