Re: How to start gnuradio

2018-08-01 Thread bengt . tornq
Thank you all for your kind explanations. -- https://mail.python.org/mailman/listinfo/python-list

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Robin Becker
On 31/07/2018 16:52, Chris Angelico wrote: On Wed, Aug 1, 2018 at 1:28 AM, MRAB wrote: On 2018-07-31 08:40, Robin Becker wrote: A bitbucket user complains that python 3.6.6 with -Wall -b prints warnings . The warning looks wrong to be. In Python 2, u'a' and b'a' would be treate

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 6:36 PM, Robin Becker wrote: > On 31/07/2018 16:52, Chris Angelico wrote: >> >> On Wed, Aug 1, 2018 at 1:28 AM, MRAB wrote: >>> >>> On 2018-07-31 08:40, Robin Becker wrote: A bitbucket user complains that python 3.6.6 with -Wall -b prints warnings > > ..

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Robin Becker
On 01/08/2018 09:52, Chris Angelico wrote: On Wed, Aug 1, 2018 at 6:36 PM, Robin Becker wrote: On 31/07/2018 16:52, Chris Angelico wrote: .. it says explicitly that numeric keys will use numeric comparison, but no . Technically, the comparison used is: a is b or a == b

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Peter Otten
Robin Becker wrote: > On 01/08/2018 09:52, Chris Angelico wrote: >> On Wed, Aug 1, 2018 at 6:36 PM, Robin Becker wrote: >>> On 31/07/2018 16:52, Chris Angelico wrote: >>.. >>> >>> it says explicitly that numeric keys will use numeric comparison, but no > . >>> >> >> Technically,

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 7:43 PM, Robin Becker wrote: > On 01/08/2018 09:52, Chris Angelico wrote: >> >> On Wed, Aug 1, 2018 at 6:36 PM, Robin Becker wrote: >>> >>> On 31/07/2018 16:52, Chris Angelico wrote: >> >> .. >>> >>> >>> it says explicitly that numeric keys will use numeric comparis

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Robin Becker
.. Nope, that would be the effect of "and", not "or". "a" is b"b" and "fallback" False "a" is b"b" or "fallback" 'fallback' You seem to be caught in your wrong mental model. I recommend that you let the matter rest for a day or so, and then look at it with a fresh eye. .. my b

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Thomas Jollans
On 01/08/18 05:16, Jeffrey Zhang wrote: I found a interesting issue when checking the Lib/datetime.py implementation in python3 This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [0]. But if you check the github page[0], or using git tag --contains, you will find v2.7.x include

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 8:40 PM, Thomas Jollans wrote: > On 01/08/18 05:16, Jeffrey Zhang wrote: >> >> I found a interesting issue when checking the Lib/datetime.py >> implementation in python3 >> >> This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [0]. >> But if you >> check th

Use a function arg in soup

2018-08-01 Thread Sayth Renshaw
Hi. I want to use a function argument as an argument to a bs4 search for attributes. I had this working not as a function # noms = soup.findAll('nomination') # nom_attrs = [] # for attr in soup.nomination.attrs: # nom_attrs.append(attr) But as I wanted to keep finding other ele

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Richard Damon
On 8/1/18 4:36 AM, Robin Becker wrote: > On 31/07/2018 16:52, Chris Angelico wrote: >> On Wed, Aug 1, 2018 at 1:28 AM, MRAB wrote: >>> On 2018-07-31 08:40, Robin Becker wrote: A bitbucket user complains that python 3.6.6 with -Wall -b prints warnings > . >>> The warning

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 9:56 PM, Richard Damon wrote: >> it says explicitly that numeric keys will use numeric comparison, but >> no mention is made of strings/bytes etc etc and there's an implication >> that object identity is used rather than comparison. In python 3.x >> b'a' is not the same as '

Re: Use a function arg in soup

2018-08-01 Thread Peter Otten
Sayth Renshaw wrote: > Hi. > > I want to use a function argument as an argument to a bs4 search for > attributes. > > I had this working not as a function ># noms = soup.findAll('nomination') > # nom_attrs = [] > # for attr in soup.nomination.attrs: > # nom_attrs.append(attr)

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Robin Becker
messing with bytes I discover that this doesn't warn with python -b if __name__=='__main__': class nbytes(bytes): def __eq__(self,other): return bytes.__eq__(self,other) if isinstance(other,bytes) else False def __hash__(self):

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 11:25 PM, Robin Becker wrote: > messing with bytes I discover that this doesn't warn with python -b > > > if __name__=='__main__': > class nbytes(bytes): > def __eq__(self,other): > return bytes.__eq__(self,other) if isinstanc

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Robin Becker
On 01/08/2018 14:38, Chris Angelico wrote: t's a warning designed to help people port code from Py2 to Py3. It's not meant to catch every possible comparison. Unless you are actually porting Py2 code and are worried that you'll be accidentally comparing bytes and text, just*don't use the -b switc

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Paul Moore
On Wed, 1 Aug 2018 at 16:10, Robin Becker wrote: > > On 01/08/2018 14:38, Chris Angelico wrote: > > t's a warning designed to help people port code from Py2 to Py3. It's > > not meant to catch every possible comparison. Unless you are actually > > porting Py2 code and are worried that you'll be ac

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Thu, Aug 2, 2018 at 1:22 AM, Paul Moore wrote: > On Wed, 1 Aug 2018 at 16:10, Robin Becker wrote: >> >> On 01/08/2018 14:38, Chris Angelico wrote: >> > t's a warning designed to help people port code from Py2 to Py3. It's >> > not meant to catch every possible comparison. Unless you are actual

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Thomas Jollans
On 01/08/18 12:49, Chris Angelico wrote: On Wed, Aug 1, 2018 at 8:40 PM, Thomas Jollans wrote: On 01/08/18 05:16, Jeffrey Zhang wrote: I found a interesting issue when checking the Lib/datetime.py implementation in python3 This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Peter Otten
Paul Moore wrote: > On Wed, 1 Aug 2018 at 16:10, Robin Becker wrote: >> >> On 01/08/2018 14:38, Chris Angelico wrote: >> > t's a warning designed to help people port code from Py2 to Py3. It's >> > not meant to catch every possible comparison. Unless you are actually >> > porting Py2 code and are

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Steven D'Aprano
On Wed, 01 Aug 2018 16:22:16 +0100, Paul Moore wrote: > On Wed, 1 Aug 2018 at 16:10, Robin Becker wrote: >> >> On 01/08/2018 14:38, Chris Angelico wrote: >> > t's a warning designed to help people port code from Py2 to Py3. It's >> > not meant to catch every possible comparison. Unless you are ac

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Paul Moore
On Wed, 1 Aug 2018 at 18:43, Steven D'Aprano wrote: > > On Wed, 01 Aug 2018 16:22:16 +0100, Paul Moore wrote: > > > If they've reported to you that your code produces warnings under -b, > > your response can quite reasonably be "thanks for the information, we've > > reviewed our bytes/string handl

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Chris Angelico
On Thu, Aug 2, 2018 at 3:37 AM, Steven D'Aprano wrote: > In another post, Chris says: > > I suspect that there may be a bit of non-thinking-C-mentality > creeping in: "if I can turn on warnings, I should, and any > warning is a problem". That simply isn't the case in Python. > > I stro

Re: Are dicts supposed to raise comparison errors

2018-08-01 Thread Serhiy Storchaka
01.08.18 21:03, Chris Angelico пише: And in any code that does not and cannot run on Python 2, the warning about bytes and text comparing unequal is nothing more than a false positive. Not always. If your code supported Python 2 in the past, or third-party dependencies supports or supported Py

Dealing with errors in interactive subprocess running python interpreter that freeze the process

2018-08-01 Thread cseberino
I can run python3 interactively in a subprocess w/ Popen but if I sent it text, that throws an exception, the process freezes instead of just printing the exception like the normal interpreter.. why? how fix? Here is my code below. (I suspect when there is an exception, there is NO output to stdi

Re: Dealing with errors in interactive subprocess running python interpreter that freeze the process

2018-08-01 Thread Chris Angelico
On Thu, Aug 2, 2018 at 6:11 AM, wrote: > I can run python3 interactively in a subprocess w/ Popen but > if I sent it text, that throws an exception, the process freezes > instead of just printing the exception like the normal interpreter.. > why? how fix? Here is my code below. > > (I suspect wh

RE: Dealing with errors in interactive subprocess running python interpreter that freeze the process

2018-08-01 Thread David Raymond
A couple notes: -I think the Python interpreter actually sends its output to stderr, so to capture it you'd probably want it to go to the same place as stdout, so use stderr = subprocess.STDOUT -You're only reading 1 line out output for each thing, so if 1 command creates multiple lines of out

Re: Use a function arg in soup

2018-08-01 Thread Sayth Renshaw
Thanks Peter ### (2) attrs is a dict, so iterating over it will lose the values. Are you sure you want that? ### Yes initially I want just the keys as a list so I can choose to filter them out to only the ones I want. # getAttr Thanks very much will get my function up and working. Cheers

Re: Dealing with errors in interactive subprocess running python interpreter that freeze the process

2018-08-01 Thread Terry Reedy
On 8/1/2018 4:11 PM, cseber...@gmail.com wrote: I can run python3 interactively in a subprocess w/ Popen but if I sent it text, that throws an exception, the process freezes instead of just printing the exception like the normal interpreter.. why? how fix? Here is my code below. (I suspect when