[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Allen Riddell
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

[issue31689] random.choices does not work with negative weights

2017-10-04 Thread Allen Riddell
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

[issue21701] create_datagram_endpoint does not receive when both local_addr and remote_addr provided

2014-06-09 Thread Allen Riddell
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

[issue21701] create_datagram_endpoint does not receive when both local_addr and remote_addr provided

2014-06-09 Thread Allen Riddell
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

[issue21701] create_datagram_endpoint does not receive when both local_addr and remote_addr provided

2014-06-09 Thread Allen Riddell
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

[issue21700] Missing mention of DatagramProtocol having connection_made and connection_lost methods

2014-06-09 Thread Allen Riddell
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."""