Allen Riddell added the comment:
Upon some reflection, I think raising a ValueError is the right thing to do.
Negative weights don't have an obvious interpretation.
--
___
Python tracker
<https://bugs.python.org/is
New submission from Allen Riddell :
Code to reproduce problem:
population = list(range(10))
weights = list(-1 * w for w in range(10))
[random.choices(population, weights) for _ in range(1000)]
will raise IndexError:
358 bisect = _bisect.bisect
359 total = cum_weights
Allen Riddell added the comment:
I gather this is the desired behavior.
If one specifies remote_addr then one only accepts packets from that address
and port. Whereas if no remote_addr is given then one accepts packets from any
address and any port.
Sorry for the noise
Allen Riddell added the comment:
(couldn't figure out how to attach multiple files)
-- client_good.py --
"""Send and receive a messages using DatagramProtocol"""
import asyncio
import time
class Helloer(asyncio.DatagramProtocol):
def connection_m
New submission from Allen Riddell:
Creating a UDP connection through ``create_datagram_endpoint`` when specifying
both remote_addr and local_addr does not work; messages are not received. If
remote_addr is removed, messages are received.
Easy to reproduce:
works: python3 client_good.py
New submission from Allen Riddell:
The following important information from PEP 3156 does not appear in the
asyncio library documentation:
"""Datagram protocols have connection_made() and connection_lost() methods with
the same signatures as stream protocols."""