Re: operations on types

2015-06-16 Thread Steven D'Aprano
On Wednesday 17 June 2015 12:42, Dr. John Q. Hacker wrote: > On Tue, Jun 16, 2015 at 9:04 PM, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info> wrote: > >> On Tue, 16 Jun 2015 19:24:03 -0500, Dr. John Q. Hacker wrote: >> >> > [Dr. Bigcock wrote:] >> >> The current syntax for adding functi

Re: operations on types

2015-06-16 Thread Chris Angelico
On Wed, Jun 17, 2015 at 2:58 PM, Ian Kelly wrote: > I'm reasonably certain that they're actually the same person, and he's > now engaging in sockpuppetry [1] by starting conversations with > himself. I used to think there was a limit to the depths of human boredom. Then I met the internet, and le

Re: Testing random

2015-06-16 Thread Jussi Piitulainen
Ned Batchelder writes: > Thomas: let's say I generate streams of N digits drawn randomly from > 0-9. I then consider the probability of a zero *never appearing once* > in my stream. Let's call that P(N). Do you agree that as N > increases, P(N) decreases? In probability theory, that could be p

Re: mix-in classes

2015-06-16 Thread Michael Torrie
On 06/16/2015 07:55 PM, Dr. John Q. Hacker wrote: > Interesting. This brings up an issue another poster brought up: In my > usage of the term "parent", I use it to mean the class that is a product of > object composition: > > class Parent(child1, child2): pass Hmm. This is a definition of "par

Re: mix-in classes

2015-06-16 Thread Dr. John Q. Hacker
On Sun, May 24, 2015 at 6:11 AM, Steven D'Aprano wrote: > On Sun, 24 May 2015 11:53 am, Dr. John Q. Hacker wrote: > But, frankly, what you describe is more likely to be a weakness of multiple > inheritance and mixins, one which should be avoided. One attempt to avoid > this problem is with traits

Re: operations on types

2015-06-16 Thread Steven D'Aprano
On Tue, 16 Jun 2015 19:24:03 -0500, Dr. John Q. Hacker wrote: > [Dr. Bigcock wrote:] >> The current syntax for adding functionality to a class using mix-in >> style via inheritance list conflates two very different things. I'm not sure why you are taking "Dr Bigcock" seriously. You know he isn't

Re: Testing random

2015-06-16 Thread Steven D'Aprano
On Wed, 17 Jun 2015 01:45:27 +0200, Thomas 'PointedEars' Lahn wrote: > The > probability of only having sons is _not_ greater than that of having > sons and one daughter or vice-versa. Take a family of four children. We can enumerate all the possibilities, using S for son and D for daughter, the

Re: Testing random

2015-06-16 Thread Steven D'Aprano
On Tue, 16 Jun 2015 13:48:04 -0700, Ned Batchelder wrote: > I apologize, I'm sure I've been using the mathematical terms > imprecisely. We are all intelligent people, so I still believe we > disagree because we are talking about different things. Neil, I believe that your actual mistake is assumi

Re: Testing random

2015-06-16 Thread Ethan Furman
On 06/16/2015 06:01 PM, Chris Angelico wrote: The only instance of gambler's fallacy I'm seeing here is "PointedEars didn't understand the last dozen emails, so he's due to understand the next one". I've given up trying to explain. +1 QotW -- https://mail.python.org/mailman/listinfo/python-lis

Re: Keypress Input

2015-06-16 Thread Michael Torrie
On 06/16/2015 02:49 PM, Grant Edwards wrote: > On 2015-06-16, John McKenzie wrote: > >> It never occurred to me something so simple as keystrokes would not >> be present in Python, a language rated as being terrific by everyone >> I know who knows it. > > Ah, but in reality "keystrokes" is not s

Re: Testing random

2015-06-16 Thread Chris Angelico
On Wed, Jun 17, 2015 at 10:36 AM, wrote: > Yes, we all know what the gambler's fallacy is, but that's not what anyone is > arguing. The only instance of gambler's fallacy I'm seeing here is "PointedEars didn't understand the last dozen emails, so he's due to understand the next one". I've given

Re: Testing random

2015-06-16 Thread MRAB
On 2015-06-17 00:45, Thomas 'PointedEars' Lahn wrote: Ned Batchelder wrote: On Tuesday, June 16, 2015 at 6:01:06 PM UTC-4, Thomas 'PointedEars' Lahn wrote: Your programmatic "proof", as all the other intuitive-empirical "proofs", and all the other counter-arguments posted before in this thread

Re: Testing random

2015-06-16 Thread sohcahtoa82
On Tuesday, June 16, 2015 at 4:48:36 PM UTC-7, Thomas 'PointedEars' Lahn wrote: > Ned Batchelder wrote: > > > On Tuesday, June 16, 2015 at 6:01:06 PM UTC-4, Thomas 'PointedEars' Lahn > > wrote: > >> Your programmatic "proof", as all the other intuitive-empirical "proofs", > >> and all the other co

Re: Set a flag on the function or a global?

2015-06-16 Thread Cameron Simpson
On 16Jun2015 18:18, Steven D'Aprano wrote: On Tuesday 16 June 2015 10:35, MRAB wrote: On 2015-06-16 01:24, sohcahto...@gmail.com wrote: Using a keyword argument for the edir function is the most intuitive and easy to read, IMO. edir() has a keyword argument: edir(x, dunders=False) suppresse

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Chris Angelico
On Wed, Jun 17, 2015 at 4:22 AM, Néstor Boscán wrote: >> On Tue, Jun 16, 2015 at 8:14 PM, Néstor Boscán wrote: >> > I tried that but it didn't work. >> > >> > I had to change /etc/selinux/config and reboot to make it work. It >> > would be >> > nice if the wsgi module generated some log that exp

Re: Testing random

2015-06-16 Thread Thomas 'PointedEars' Lahn
Ned Batchelder wrote: > On Tuesday, June 16, 2015 at 6:01:06 PM UTC-4, Thomas 'PointedEars' Lahn > wrote: >> Your programmatic "proof", as all the other intuitive-empirical "proofs", >> and all the other counter-arguments posted before in this thread, is >> flawed. As others have pointed out at th

Re: Testing random

2015-06-16 Thread Ned Batchelder
On Tuesday, June 16, 2015 at 6:01:06 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Ned Batchelder wrote: > > > [...] > > This is done empirically, by producing `nseq` sequences of > > `nrolls` rolls of the die. Each sequence is examined to > > see if it has a zero. The total number of

Re: Testing random

2015-06-16 Thread Ian Kelly
On Jun 16, 2015 4:58 PM, "Ian Kelly" wrote: > > On Tue, Jun 16, 2015 at 4:30 PM, wrote: > > On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote: > >> This should give you pause: In real mathematics, events with zero > >> probability can occur. > > > > Nobody will disag

Re: Testing random

2015-06-16 Thread Ian Kelly
On Tue, Jun 16, 2015 at 4:30 PM, wrote: > On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn > wrote: >> This should give you pause: In real mathematics, events with zero >> probability can occur. > > Nobody will disagree with that. The probability of me winning the lotter

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tue, 16 Jun 2015 13:45:01 +0100, Oscar Benjamin wrote: > On 16 June 2015 at 09:18, Steven D'Aprano > wrote: >> >> The primary use-case (at least *my* use-case, and hopefully others) is >> to have "from module import edir as dir" in their Python startup file. >> That means that when running int

Re: Testing random

2015-06-16 Thread sohcahtoa82
On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote: > Ned Batchelder wrote: > > > [...] > > This is done empirically, by producing `nseq` sequences of > > `nrolls` rolls of the die. Each sequence is examined to > > see if it has a zero. The total number of

Re: Testing random

2015-06-16 Thread Thomas 'PointedEars' Lahn
Ned Batchelder wrote: > […] > This is done empirically, by producing `nseq` sequences of > `nrolls` rolls of the die. Each sequence is examined to > see if it has a zero. The total number of no-zero > sequences divided `nseq` is the probability. No, it is not. It is the relativ

Re: Keypress Input

2015-06-16 Thread Paul Rubin
John McKenzie writes: > Would like a set-up where something happens when a key is pressed. Not > propose a question, have the user type something, then hit return, then > something happens, but just the R key is pressed, something happens, The quick answer is that you want raw mode tty input.

Re: Pandas SQL Update

2015-06-16 Thread Mario R. Osorio
You are not specifying how are you doing the comparison, but here is my 2 cents: Import the foxpro tables into the MySQL database and then you'll be able to do your update in a single SQL statement, which, even for that many records would take some only a few seconds, then delete th imported da

Re: Keypress Input

2015-06-16 Thread Grant Edwards
On 2015-06-16, John McKenzie wrote: > It never occurred to me something so simple as keystrokes would not > be present in Python, a language rated as being terrific by everyone > I know who knows it. Ah, but in reality "keystrokes" is not simple at all. Keyboards and input handling is a very me

Re: Testing random

2015-06-16 Thread Ned Batchelder
On Tuesday, June 16, 2015 at 3:21:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Ned Batchelder wrote: > > > You aren't agreeing because you are arguing about different things. > > Thomas is talking about the relative probability of sequences of digits. > > There is no such thing as “relative pr

Re: Testing random

2015-06-16 Thread random832
On Tue, Jun 16, 2015, at 15:18, Thomas 'PointedEars' Lahn wrote: > There is no such thing as “relative probability”, except perhaps in > popular- > scientific material and bad translations. You might mean relative > _frequency_, but I was not talking about that specifically. The probability of o

Re: Keypress Input

2015-06-16 Thread John McKenzie
That was the impression I got reading some comments people made online and doing research, so I focused on tkinter. As I mentioned in the 4th sentence of the post you quoted I discovered that was not the case, but by then I had already done some work on the tkinter script so I kept with it.

Re: python financial data cleaning

2015-06-16 Thread Mark Lawrence
On 15/06/2015 22:01, Sebastian M Cheung via Python-list wrote: On Monday, June 15, 2015 at 11:19:48 AM UTC+1, Mark Lawrence wrote: On 15/06/2015 11:12, Sebastian M Cheung via Python-list wrote: How to do financial data cleaning ? Say I assume a list of 1000 finance series data in myList = Open

Re: Testing random

2015-06-16 Thread Thomas 'PointedEars' Lahn
Ned Batchelder wrote: > You aren't agreeing because you are arguing about different things. > Thomas is talking about the relative probability of sequences of digits. There is no such thing as “relative probability”, except perhaps in popular- scientific material and bad translations. You might

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Néstor Boscán
On Tuesday, June 16, 2015, Chris Warrick wrote: > On Tue, Jun 16, 2015 at 8:14 PM, Néstor Boscán > wrote: > > I tried that but it didn't work. > > > > I had to change /etc/selinux/config and reboot to make it work. It > would be > > nice if the wsgi module generated some log that explains why y

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Chris Warrick
On Tue, Jun 16, 2015 at 8:14 PM, Néstor Boscán wrote: > I tried that but it didn't work. > > I had to change /etc/selinux/config and reboot to make it work. It would be > nice if the wsgi module generated some log that explains why you get the > 403. There are several posibilities. Well, that’s

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Néstor Boscán
I tried that but it didn't work. I had to change /etc/selinux/config and reboot to make it work. It would be nice if the wsgi module generated some log that explains why you get the 403. There are several posibilities. Regards, Nestor On Tuesday, June 16, 2015, Chris Warrick wrote: > On Tue,

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Chris Warrick
On Tue, Jun 16, 2015 at 12:11 PM, Néstor Boscán wrote: > I disabled selinux completely and the page worked. So, selinux was the problem (which is typical, it’s a really dumb piece of software) The command to disable enforcing temporarily is actually "setenforce 0". Though you would need to issue

EuroPython 2015: Financial Aid

2015-06-16 Thread M.-A. Lemburg
The financial aid work group has started to email everyone who applied for financial aid this year. We are fortunate to have a budget of almost 20,000 EUR available for financial aid this year, thanks to well running ticket sales, speakers who donated their speaker discounts towards the finaid bud

Re: Keypress Input

2015-06-16 Thread Michael Torrie
On 06/14/2015 11:23 PM, John McKenzie wrote: > Thank to the others who joined in and posted replies. > > Michael, your assumption is correct. To quote my original post, "and I > want this working on a Raspberry Pi." Doing a superficial look at curses > and getch it looks excessively complicate

Re: Creating .exe file in Python

2015-06-16 Thread subhabrata . banerji
On Tuesday, June 16, 2015 at 9:33:58 PM UTC+5:30, Chris Angelico wrote: > On Wed, Jun 17, 2015 at 1:17 AM, wrote: > > Thanks. The scipy issue seems solved. But this silly issue is giving so > > much of time. I am checking. Please see a sample code, > > > > import sys > > sys.stderr = sys.stdout >

Re: Creating .exe file in Python

2015-06-16 Thread Chris Angelico
On Wed, Jun 17, 2015 at 1:17 AM, wrote: > Thanks. The scipy issue seems solved. But this silly issue is giving so much > of time. I am checking. Please see a sample code, > > import sys > sys.stderr = sys.stdout > class Colors: > def Blue(self): > self.var="This is Blue" > pr

Re: Creating .exe file in Python

2015-06-16 Thread Ian Kelly
On Tue, Jun 16, 2015 at 9:17 AM, wrote: > On Tuesday, June 16, 2015 at 8:35:39 PM UTC+5:30, Laura Creighton wrote: >> In a message of Tue, 16 Jun 2015 06:56:12 -0700, writes: >> >ii) In a class how may I include if __name__ == "__main__": with multiple >> >methods? But I think this is easy ques

Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

2015-06-16 Thread Ian Kelly
On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers wrote: > As importlib has been added in python 3 and up I decided to use it's > abilities to create a plugin system for truly modular development in python. > > Pyitect has the ability to drop in components and resolve dependencies. Even > load different

Re: Creating .exe file in Python

2015-06-16 Thread subhabrata . banerji
On Tuesday, June 16, 2015 at 8:35:39 PM UTC+5:30, Laura Creighton wrote: > In a message of Tue, 16 Jun 2015 06:56:12 -0700, writes: > >ii) In a class how may I include if __name__ == "__main__": with multiple > >methods? But I think this is easy question there should be lot of web help. > > > >I

Re: Keypress Input

2015-06-16 Thread John McKenzie
It appears that one of my posts was cut off. It contains my script but none of the lengthy text in front of it. To summarize, my set-up consists of three "massive arcade buttons" from Adafruit. one red, one blue, one yellow. They are connected to a Kade Device that is connected to a Raspberr

Re: Creating .exe file in Python

2015-06-16 Thread Laura Creighton
In a message of Tue, 16 Jun 2015 06:56:12 -0700, subhabrata.bane...@gmail.com w rites: >ii) In a class how may I include if __name__ == "__main__": with multiple >methods? But I think this is easy question there should be lot of web help. > >If anyone may kindly suggest. > >Regards, >Subhabrata B

Re: Set a flag on the function or a global?

2015-06-16 Thread Ethan Furman
On 06/16/2015 06:56 AM, Michael Torrie wrote: On 06/15/2015 06:19 PM, Ethan Furman wrote: Setting a global on the module (which I may not have, and probably didn't, import) for only one function is overkill. What do you mean? Even if you pull in just one function from the module on an import

Re: Creating .exe file in Python

2015-06-16 Thread subhabrata . banerji
On Monday, June 15, 2015 at 9:59:33 PM UTC+5:30, Laura Creighton wrote: > I don't have a windows system, so my knowledge of such things is > minimal. But looks like this person had the same problem you have, > and got some suggestions on how to fix it. > > http://stackoverflow.com/questions/12127

Re: Set a flag on the function or a global?

2015-06-16 Thread Peter Otten
Steven D'Aprano wrote: > I have a function in a module which is intended to be used by importing > that name alone, then used interactively: > > from module import edir > edir(args) > > > edir is an enhanced version of dir, and one of the enhancements is that > you can filter out dunder

Re: Set a flag on the function or a global?

2015-06-16 Thread Michael Torrie
On 06/15/2015 06:19 PM, Ethan Furman wrote: > Setting a global on the module (which I may not have, and probably > didn't, import) for only one function is overkill. What do you mean? Even if you pull in just one function from the module on an import, the module's initialization code still runs.

Re: Set a flag on the function or a global?

2015-06-16 Thread Michael Torrie
On 06/15/2015 06:20 PM, Ben Finney wrote: > I'm surprised by your assertion. To my mind, outside callers get simple > and direct access to the attribute, whereas the code of the function > itself does not have such easy access; unlike ‘self’ for the current > instance of a class, there's no obvious

Re: Set a flag on the function or a global?

2015-06-16 Thread Oscar Benjamin
On 16 June 2015 at 09:18, Steven D'Aprano wrote: > > The primary use-case (at least *my* use-case, and hopefully others) is to > have "from module import edir as dir" in their Python startup file. That > means that when running interactively, they will get the enhanced version of > dir, but when r

Re: Set a flag on the function or a global?

2015-06-16 Thread Ron Adam
On 06/16/2015 05:15 AM, Steven D'Aprano wrote: On Tuesday 16 June 2015 10:24, Ron Adam wrote: >Another way is to make it an object with a __call__ method. > >The the attribute can be accessed from both outside and inside dependably. That's what functions are, objects with a __call__ method:

Re: Creating .exe file in Python

2015-06-16 Thread subhabrata . banerji
On Monday, June 15, 2015 at 9:59:33 PM UTC+5:30, Laura Creighton wrote: > I don't have a windows system, so my knowledge of such things is > minimal. But looks like this person had the same problem you have, > and got some suggestions on how to fix it. > > http://stackoverflow.com/questions/12127

EuroPython 2015: Schedule online

2015-06-16 Thread M.-A. Lemburg
We are happy to announce the schedule for EuroPython 2015 in Bilbao. With over 200 sessions, over 180 speakers, 5 days of talks, trainings, keynotes, lightning talks and open spaces, followed by 2 days of sprints, EuroPython will be one of the most exciting and vibrant Python events this year:

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Néstor Boscán
Hi I disabled selinux completely and the page worked. Regards, Nestor On Tuesday, June 16, 2015, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Tuesday 16 June 2015 13:31, Néstor Boscán wrote: > > > Tried it and I keep having the same error. Isn't there a log file where I

Re: Set a flag on the function or a global?

2015-06-16 Thread Jonas Wielicki
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 16.06.2015 01:57, Steven D'Aprano wrote: > Alternatively, I can use a flag set on the function object itself: > > edir.dunders = False > > > Naturally you can always override the default by explicitly > specifying a keyword argument edir(obj,

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 16:06, Mark Lawrence wrote: > On 16/06/2015 00:57, Steven D'Aprano wrote: [...] >> Naturally you can always override the default by explicitly specifying a >> keyword argument edir(obj, dunders=flag). >> >> Thoughts and feedback? Please vote: a module global, or a flag on t

Re: Trying to configure Apache and Python 2.7 on Red Hat I get 403 Forbidden

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 13:31, Néstor Boscán wrote: > Tried it and I keep having the same error. Isn't there a log file where I > can check what is causing this? Probably. Have you googled for "selinux log file"? We're not experts on SELinux, this is a Python mailing list, not a specialist SEL

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 10:24, Ron Adam wrote: > Another way is to make it an object with a __call__ method. > > The the attribute can be accessed from both outside and inside dependably. That's what functions are, objects with a __call__ method: py> (lambda: None).__call__ One slight disad

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 10:20, Ben Finney wrote: > Chris Angelico writes: > >> On Tue, Jun 16, 2015 at 9:57 AM, Steven D'Aprano >> wrote: >> > I can use a flag set on the function object itself: >> > >> > edir.dunders = False >> >> For most situations, the last one is extremely surprising - att

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 10:37, Paul Rubin wrote: > Steven D'Aprano writes: >> Thoughts and feedback? Please vote: a module global, or a flag on the >> object? Please give reasons, and remember that the function is intended >> for interactive use. > > Both are bad. More state to remember, ugh.

ANN: eGenix pyOpenSSL Distribution 0.13.10

2015-06-16 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.10 An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for OpenS

Re: Set a flag on the function or a global?

2015-06-16 Thread Steven D'Aprano
On Tuesday 16 June 2015 10:35, MRAB wrote: > On 2015-06-16 01:24, sohcahto...@gmail.com wrote: >> Using a keyword argument for the edir function is the most intuitive >> and easy to read, IMO. edir() has a keyword argument: edir(x, dunders=False) suppresses the return of dunder names. But since