Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Terry Reedy
On 3/19/2018 1:04 PM, Irv Kalb wrote: However, there is one warning that I am seeing often, an > I'm not sure about how to handle it. The warning I see is: "Instance attribute defined outside of __init__ ..." Style checkers are notorious for sometimes giving bad advice and being overly opi

how to obtain the text for BeautifulSoup object

2018-03-19 Thread Nathan Zhu
Hi Team, could anyone help me? for webpage having source code like this: ... number name I only can use below sentence, since there are a lot of tag em and tag a in other area. output = bs4.BeautifulSoup(res.content,'lxml').findAll("span",{"class":"xst thread-name"}) how can I get th

Re: Thank you Python community!

2018-03-19 Thread Rick Johnson
On Monday, March 19, 2018 at 6:37:21 PM UTC-5, Ben Finney wrote: > -- > \ "Success is going from one failure to the next without a loss | > `\ of enthusiasm." -- Winston Churchill | > _o__) | > B

Re: {:2X} didn't output what I expected

2018-03-19 Thread Chris Angelico
On Tue, Mar 20, 2018 at 11:32 AM, wrote: > Chris Angelico於 2018年3月20日星期二 UTC+8上午8時06分05秒寫道: >> On Tue, Mar 20, 2018 at 10:46 AM, wrote: >> > D:\Temp>py >> > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 >> > bit (Intel)] on win32 >> > Type "help", "copyright", "credi

Re: {:2X} didn't output what I expected

2018-03-19 Thread jfong
Chris Angelico於 2018年3月20日星期二 UTC+8上午8時06分05秒寫道: > On Tue, Mar 20, 2018 at 10:46 AM, wrote: > > D:\Temp>py > > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 > > bit (Intel)] on win32 > > Type "help", "copyright", "credits" or "license" for more information. > '{:0

Re: {:2X} didn't output what I expected

2018-03-19 Thread Chris Angelico
On Tue, Mar 20, 2018 at 10:46 AM, wrote: > D:\Temp>py > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. '{:02X}'.format(256) > '100' > What I expected is '00'. Am I

Re: Thank you Python community!

2018-03-19 Thread Etienne Robillard
Le 2018-03-19 à 19:36, Ben Finney a écrit : Etienne Robillard writes: I would like to make such an experimental research/investigation on the effects of Python software programming on opioid addiction. :-) Okay. The wording of your message implied that you know this already happens now, tho

{:2X} didn't output what I expected

2018-03-19 Thread jfong
D:\Temp>py Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> '{:02X}'.format(256) '100' >>> What I expected is '00'. Am I wrong? Best Regards, Jach Fong -- https://mail.python.

Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Steven D'Aprano
On Mon, 19 Mar 2018 10:04:53 -0700, Irv Kalb wrote: > Some people say > that this type of thing is fine and these warnings should just be > ignored. While others say that all instance variables should be defined > in the __init__ method. Whenever anyone says "you should do this", the question to

Re: Thank you Python community!

2018-03-19 Thread Ben Finney
Etienne Robillard writes: > I would like to make such an experimental research/investigation on > the effects of Python software programming on opioid addiction. :-) Okay. The wording of your message implied that you know this already happens now, though. How did you come to know this? -- \

Re: Thank you Python community!

2018-03-19 Thread Etienne Robillard
Hi Ben, Thank you for your reply. I would like to make such an experimental research/investigation on the effects of Python software programming on opioid addiction. :-) Probably studying the learning of Python in people with cocaine and heroin addiction would be significant and interesting.

Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Ben Finney
Irv Kalb writes: > In this class, I get warnings on the single lines of the conceal and > reveal methods. This is good! It prompts the question: Why are those methods defined as they are? If those methods are only ever intended to set the value of an attribute: Why not just set that attribute d

Re: Thank you Python community!

2018-03-19 Thread Ben Finney
Etienne Robillard writes: > I would like to thank you guys sincerely for helping a lot of people > to stay clean, and focus on programming high-level stuff in Python > instead of doing some really nasty drugs. Thank you for the kind words. I'd love to believe the Python community has the signif

Re: Missing python36.dll

2018-03-19 Thread Jerry Hill
On Mon, Mar 19, 2018 at 5:07 PM, MRAB wrote: > You didn't say which installer you used. > ​It might also be helpful to know: Did you install python for "Just Me" or "All Users" in the installer? Does the user you're logged in as have enough authority to install for All Users if that's what you

Re: Missing python36.dll

2018-03-19 Thread MRAB
On 2018-03-19 19:33, Adrian Ordona wrote: Hi - just downloaded the latest version of Python (3.6.4) but keep getting an error because of missing .dll file. i tried uninstalling and reinstalling it but still getting the same error. Search online for the file but to no avail. Can someone direct

Re: Thank you Python community!

2018-03-19 Thread Etienne Robillard
Le 2018-03-19 à 15:21, Larry Martell a écrit : On Mon, Mar 19, 2018 at 12:08 PM, Etienne Robillard wrote: You guys just made me realize something very obvious. :-) I'm in the process right now of watching the excellent documentary named "Drugs Inc." on Netflix and I'm basically stunned and d

Re: Thank you Python community!

2018-03-19 Thread Rob Gaddi
On 03/19/2018 12:40 PM, Tim Daneliuk wrote: On 03/19/2018 02:05 PM, bartc wrote: I've often wondered what the guys who invented C (around 1970) must have been  smoking to have come up with some of those ideas. I dunno, but I do know that - if they were smoking something - it was rolled in gree

Re: Thank you Python community!

2018-03-19 Thread Tim Daneliuk
On 03/19/2018 02:05 PM, bartc wrote: > I've often wondered what the guys who invented C (around 1970) must have been  > smoking to have come up with some of those ideas. I dunno, but I do know that - if they were smoking something - it was rolled in greenbar paper ... -- https://mail.python.org/m

Missing python36.dll

2018-03-19 Thread Adrian Ordona
Hi - just downloaded the latest version of Python (3.6.4) but keep getting an error because of missing .dll file. i tried uninstalling and reinstalling it but still getting the same error. Search online for the file but to no avail. Can someone direct me as to where to download the missing dll f

Re: Thank you Python community!

2018-03-19 Thread Larry Martell
On Mon, Mar 19, 2018 at 12:08 PM, Etienne Robillard wrote: > You guys just made me realize something very obvious. :-) > > I'm in the process right now of watching the excellent documentary named > "Drugs Inc." on Netflix and I'm basically stunned and deeply concerned about > the major opioid epid

Re: Thank you Python community!

2018-03-19 Thread bartc
On 19/03/2018 16:08, Etienne Robillard wrote: You guys just made me realize something very obvious. :-) I'm in the process right now of watching the excellent documentary named "Drugs Inc." on Netflix and I'm basically stunned and deeply concerned about the major opioid epidemic in the US. I

Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Chris Angelico
On Tue, Mar 20, 2018 at 4:25 AM, Ethan Furman wrote: > Define them in __init__; otherwise, you get an error if reveal() is called > before conceal() is. Also, a card is either revealed or concealed, it can't > be both and it can't be neither -- so set it in __init__. __init__ calls conceal. Chr

Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Ethan Furman
On 03/19/2018 10:04 AM, Irv Kalb wrote: I am building some classes for use in future curriculum. I am using PyCharm for my development. On the right hand edge of the PyCharm editor window, you get some little bars indicating warnings or errors in your code. I like this feature and try to c

Re: Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Ned Batchelder
On 3/19/18 1:04 PM, Irv Kalb wrote: I am building some classes for use in future curriculum. I am using PyCharm for my development. On the right hand edge of the PyCharm editor window, you get some little bars indicating warnings or errors in your code. I like this feature and try to clean

Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Irv Kalb
I am building some classes for use in future curriculum. I am using PyCharm for my development. On the right hand edge of the PyCharm editor window, you get some little bars indicating warnings or errors in your code. I like this feature and try to clean up as many of those as I can. However

Re: how do I retry a command only for a specific exception / error

2018-03-19 Thread Ganesh Pal
On Fri, Mar 16, 2018 at 11:21 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 16 Mar 2018 11:04:22 +0530, Ganesh Pal wrote: > > > All that I am trying to do here is write a generic function that will > > re-retry > > the command few more times before failing the tes

Thank you Python community!

2018-03-19 Thread Etienne Robillard
You guys just made me realize something very obvious. :-) I'm in the process right now of watching the excellent documentary named "Drugs Inc." on Netflix and I'm basically stunned and deeply concerned about the major opioid epidemic in the US. I would like to thank you guys sincerely for hel

Re: Keys in dict and keys not in dict

2018-03-19 Thread Andrew Z
Beautiful. Thank you Chris, Ben, Peter and Inada. On Mar 19, 2018 3:14 AM, "INADA Naoki" wrote: > > expected = {"foo", "bar", "spam"} > > missing = expected - set(json.keys()) > > > > dict.keys() returns set-like object. > So `missing = expected - json.keys()` works fine, and it's more e

Re: Is it possible to do something similar to gnome glib's GSource in asyncio?

2018-03-19 Thread Vitaly Krug
Mea culpa! It sounds like I should be able to create a specialized future to test for my loop exit condition and then use that future with asyncio loop's `run_until_complete()` method. On Sat, Mar 17, 2018 at 7:39 PM, Vitaly Krug wrote: > I am looking for a way to get a callback each time before

Is it possible to do something similar to gnome glib's GSource in asyncio?

2018-03-19 Thread Vitaly Krug
I am looking for a way to get a callback each time before asyncio event loop goes back to waiting on I/O (select, epoll, etc.). Documentation and googling for the answer hasn't helped yet. I am looking for something similar to gnome glib's GSource interface ( https://developer.gnome.org/glib/stabl

Re: Keys in dict and keys not in dict

2018-03-19 Thread INADA Naoki
> expected = {"foo", "bar", "spam"} > missing = expected - set(json.keys()) > dict.keys() returns set-like object. So `missing = expected - json.keys()` works fine, and it's more efficient. -- INADA Naoki -- https://mail.python.org/mailman/listinfo/python-list

Re: Keys in dict and keys not in dict

2018-03-19 Thread Peter Otten
Ben Finney wrote: > Chris Angelico writes: > >> Sounds like a set operation to me. >> >> expected = {"foo", "bar", "spam"} >> missing = expected - set(json) > > That works (because iterating a dict returns its keys). But it is less > immediately understandable, IMO, than this:: > > expecte