Re: Enumerating all 3-tuples

2018-03-20 Thread Steven D'Aprano
On Tue, 13 Mar 2018 23:56:37 +0100, Denis Kasak wrote: [...] > The triples can be viewed as a pair of a pair and a natural number: > > (1,1),1 (1,1),2 (1,1),3 ... > (2,1),1 (2,1),2 (2,1),3 ... > (1,2),1 (1,2),2 (1,2),3 ... [...] > This leads fairly naturally to the implementation. > > from

Re: Multiprocessing on a remote host

2018-03-20 Thread Steven D'Aprano
On Wed, 21 Mar 2018 02:20:16 +, Larry Martell wrote: > Is there a way to use the multiprocessing lib to run a job on a remote > host? Don't try to re-invent the wheel. This is a solved problem. https://stackoverflow.com/questions/1879971/what-is-the-current-choice-for-doing-rpc-in-python I'

Multiprocessing on a remote host

2018-03-20 Thread Larry Martell
Is there a way to use the multiprocessing lib to run a job on a remote host? -- https://mail.python.org/mailman/listinfo/python-list

Re: Thank you Python community!

2018-03-20 Thread Gregory Ewing
John Ladasky wrote: Yeah, it's either Python or that horrifying street drug PHP. I know which one I'm choosing. Python is definitely the best language for getting high on: https://xkcd.com/353/ -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Sig monster agency (was: Thank you Python community!)

2018-03-20 Thread Ben Finney
Alister via Python-list writes: > maybe [Ben's signatures are not sarcasm] - I use fortune to generate > mine & it can be supprisingly apt at times Yes. They are randomly chosen by my sig monster when I compose a message; I have some option to ask for another, but no direct input in the selectio

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Ben Finney
Steven D'Aprano writes: > What they came up with is that its really hard to do useful work for > large applications with 100% pure functional programming styles. As you > add functional techniques to your code, you find your code quality > increasing. Things like pure functions with no hidden

Celestial Emporium of Benevolent Knowledge (was: Style Q: Instance variables defined outside of __init__)

2018-03-20 Thread Ben Finney
Neil Cerutti writes: > The Introduction to Computer Science class I'm taking divided program > design into two categories: Top Down Design, and Object Oriented > Design. It's good, because it reminded me of the wisdom of dividing > memory into Random Access and Read Only. > > My automotive course

in multiprocessing pool map how to stop one process from executing ahead

2018-03-20 Thread Subramanian P V
I am excecting custom commands like shell on multiple linux hosts. and if in one host one of the commands fail. I want that process not to proceed. If the remote command throws an error i am logging it .. but the process goes to next command . but if i terminate the command, the process will t

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread codewizard
On Tuesday, March 20, 2018 at 1:10:19 PM UTC-4, Irv Kalb wrote: > I am aware of all the issues involved. My example code was an attempt to > demonstrate the clearest, simplest case possible. My question is not about > this small case. In classes designed for full games, I often have a "reset"

Re: [OT] Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Grant Edwards
On 2018-03-20, Tom Evans via Python-list wrote: > On Tue, Mar 20, 2018 at 5:25 PM, Grant Edwards > wrote: >> On 2018-03-20, Neil Cerutti wrote: >> >>> My automotive course will probaly divide cars into Automatic >>> Transmission, and Front Wheel Drive. >> >> I get your point: the two characterist

Re: Thank you Python community!

2018-03-20 Thread John Ladasky
On Monday, March 19, 2018 at 9:28:09 AM UTC-7, Etienne Robillard wrote: > 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. Yeah, it's either Python or that horrif

Re: Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
On Tue, Mar 20, 2018 at 5:36 PM, Rob Gaddi wrote: > If all you're doing is a thin-wrapper around a C library, have you thought > about just using ctypes? Yep; the C library whose API I'm using uses macros to cast things to the right structure, and (similar to Cython), as I already _have_ the code

[OT] Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Tom Evans via Python-list
On Tue, Mar 20, 2018 at 5:25 PM, Grant Edwards wrote: > On 2018-03-20, Neil Cerutti wrote: > >> My automotive course will probaly divide cars into Automatic >> Transmission, and Front Wheel Drive. > > I get your point: the two characteristics are, in theory, orthogonal. > But, in the US, the two

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Chris Angelico
On Wed, Mar 21, 2018 at 4:18 AM, Neil Cerutti wrote: > The Introduction to Computer Science class I'm taking divided > program design into two categories: Top Down Design, and Object > Oriented Design. It's good, because it reminded me of the wisdom > of dividing memory into Random Access and Read

Re: Writing a C extension - borrowed references

2018-03-20 Thread Rob Gaddi
On 03/20/2018 10:03 AM, Tom Evans wrote: On Tue, Mar 20, 2018 at 4:38 PM, Chris Angelico wrote: BTW, have you looked into Cython? It's smart enough to take care of a lot of this sort of thing for you. I did a bit; this work is to replace our old python 2 SAML client, which used python-lasso a

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Grant Edwards
On 2018-03-20, Neil Cerutti wrote: > My automotive course will probaly divide cars into Automatic > Transmission, and Front Wheel Drive. I get your point: the two characteristics are, in theory, orthogonal. But, in the US, the two appear to be correlated. ISTM that cars with manual transmission

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Neil Cerutti
On 2018-03-20, Rick Johnson wrote: > On Tuesday, March 20, 2018 at 6:14:34 AM UTC-5, Alister wrote: >> On Tue, 20 Mar 2018 08:52:29 +, Steven D'Aprano wrote: >> > On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote: >> > >> > > I think a claim that in all programs all attributes >> > > shou

Re: Writing a C extension - borrowed references

2018-03-20 Thread Python
On Tue, Mar 20, 2018 at 04:33:15PM +, Paul Moore wrote: > Or, to put it another way, "if you need to ask, you can't afford to". If you don't know, you need to ask so that you can learn whether or not you can afford to. :( -- https://mail.python.org/mailman/listinfo/python-list

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Irv Kalb
> On Mar 19, 2018, at 10:27 AM, Ned Batchelder wrote: > > 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 warn

Re: Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
On Tue, Mar 20, 2018 at 4:38 PM, Chris Angelico wrote: > BTW, have you looked into Cython? It's smart enough to take care of a > lot of this sort of thing for you. I did a bit; this work is to replace our old python 2 SAML client, which used python-lasso and python-libxml2, both packages that are

Re: [OT] Re: Thank you Python community!

2018-03-20 Thread Ned Batchelder
On 3/20/18 12:08 PM, Rick Johnson wrote: On Tuesday, March 20, 2018 at 7:03:11 AM UTC-5, Adriaan Renting wrote: (on the subject of the opioid epidemic) The [OT] in the subject line is right: let's not get off on a political tangent. --Ned. -- https://mail.python.org/mailman/listinfo/python-

Re: Writing a C extension - borrowed references

2018-03-20 Thread Chris Angelico
On Wed, Mar 21, 2018 at 3:22 AM, Tom Evans via Python-list wrote: > Hi all > > I'm writing my first C extension for Python here, and all is going > well. However, I was reading [1], and the author there is advocating > Py_INCREF 'ing *every* borrowed reference. BTW, have you looked into Cython? I

Re: Writing a C extension - borrowed references

2018-03-20 Thread Chris Angelico
On Wed, Mar 21, 2018 at 3:22 AM, Tom Evans via Python-list wrote: > Hi all > > I'm writing my first C extension for Python here, and all is going > well. However, I was reading [1], and the author there is advocating > Py_INCREF 'ing *every* borrowed reference. > > Now, I get that if I do somethin

Re: Writing a C extension - borrowed references

2018-03-20 Thread Paul Moore
On 20 March 2018 at 16:22, Tom Evans via Python-list wrote: > Hi all > > I'm writing my first C extension for Python here, and all is going > well. However, I was reading [1], and the author there is advocating > Py_INCREF 'ing *every* borrowed reference. > > Now, I get that if I do something to m

Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
Hi all I'm writing my first C extension for Python here, and all is going well. However, I was reading [1], and the author there is advocating Py_INCREF 'ing *every* borrowed reference. Now, I get that if I do something to mutate and perhaps invalidate the PyObject that was borrowed I can get unp

Re: [OT] Re: Thank you Python community!

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 7:03:11 AM UTC-5, Adriaan Renting wrote: (on the subject of the opioid epidemic) > That sounds more like a conspiracy theory than a real > analysis of the problem. Looking at it from here in > Europe, most of the analysis I've been able to read and > watch about it

Re: [OT] Re: Thank you Python community!

2018-03-20 Thread Larry Martell
On Tue, Mar 20, 2018 at 6:19 AM, Adriaan Renting wrote: > > That sounds more like a conspiracy theory than a real analysis of the > problem. Follow the money. > > > Looking at it from here in Europe, most of the analysis I've been able to > read and watch about it, points to a different cause: >

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Chris Angelico
On Wed, Mar 21, 2018 at 2:15 AM, Steven D'Aprano wrote: > On Tue, 20 Mar 2018 11:14:13 +, Alister via Python-list wrote: > >> but why would a functional programmer be programming an OOP class? > > I read a really good blog post a while back, which I sadly can no longer > find (I had it bookmar

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

2018-03-20 Thread Steven D'Aprano
On Mon, 19 Mar 2018 22:08:09 +0530, Ganesh Pal wrote: I'm sorry Ganesh, you have appeared to have just quoted my post without writing anything new. (I haven't taken the time to read your post in fine detail.) Apart from "Regards, Ganesh" at the very end, everything is quoted text (starting with

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2018 11:14:13 +, Alister via Python-list wrote: > but why would a functional programmer be programming an OOP class? I read a really good blog post a while back, which I sadly can no longer find (I had it bookmarked until Firefox ate my bookmarks) that discussed exactly that

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 1:43:39 AM UTC-5, Terry Reedy wrote: [...] > > class Card(): > > > > BACK_OF_CARD_IMAGE = pygame.image.load('images/backOfCard.png') > > > > def __init__(self, window, name, suit, value): > > self.window = window > > self.suit = suit > >

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Rick Johnson
On Tuesday, March 20, 2018 at 6:14:34 AM UTC-5, Alister wrote: > On Tue, 20 Mar 2018 08:52:29 +, Steven D'Aprano wrote: > > On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote: > > > > > I think a claim that in all programs all attributes > > > should be set *in* __init__, as opposed to *dur

Re: curious asymmetry in range limiting

2018-03-20 Thread Wolfgang Maier
On 03/20/2018 03:21 PM, Robin Becker wrote: I don't know how I never came across this before, but there's a curious asymmetry in the way ranges are limited Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "lic

Re: curious asymmetry in range limiting

2018-03-20 Thread Robin Becker
So eventually I tried this C:\code\hg-repos\reportlab>\python36\python -c"s='0123456789';print(repr(s[-5:15]))" '56789' C:\code\hg-repos\reportlab>\python36\python -c"s='0123456789';print(repr(s[-6:15]))" '456789' and the light dawned :) seems the negative indexes rules apply to both On

curious asymmetry in range limiting

2018-03-20 Thread Robin Becker
I don't know how I never came across this before, but there's a curious asymmetry in the way ranges are limited Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> s = '01234567

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Grant Edwards
On 2018-03-20, Alister via Python-list wrote: > but why would a functional programmer be programming an OOP class? Part of a 12-step recovery plan? ;) -- Grant Edwards grant.b.edwardsYow! Hello. I know at the divorce rate

Re: Thank you Python community!

2018-03-20 Thread Etienne Robillard
Le 2018-03-19 à 22:21, Rick Johnson a écrit : 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__)

[OT] Re: Thank you Python community!

2018-03-20 Thread Adriaan Renting
That sounds more like a conspiracy theory than a real analysis of the problem. Looking at it from here in Europe, most of the analysis I've been able to read and watch about it, points to a different cause: A lack of security: People flee to drugs (alcohol, tobacco, coffee and other (illeg

Re: Thank you Python community!

2018-03-20 Thread Alister via Python-list
On Mon, 19 Mar 2018 19:21:04 -0700, Rick Johnson wrote: > 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

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Alister via Python-list
On Tue, 20 Mar 2018 08:52:29 +, Steven D'Aprano wrote: > On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote: > >> I think a claim that in all programs all attributes should be set *in* >> __init__, as opposed to *during* initialization, is wrong. All >> attribute setting is side-effect fr

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2018 02:43:13 -0400, Terry Reedy wrote: > I think a claim that in all programs all attributes should be set *in* > __init__, as opposed to *during* initialization, is wrong. All > attribute setting is side-effect from a functional view (and usually > 'bad' to a functionalist). The

Re: how to obtain the text for BeautifulSoup object

2018-03-20 Thread Peter Otten
Nathan Zhu wrote: > 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("spa