Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 2:08 PM, Gregory Ewing wrote: > Stefan Ram wrote: >> >> Well, then one can ask about the entropy of a data source >> that only is emitting this message. > > > You can, but it's still the *source* that has the entropy, > not the message. > > (And the answer in that case

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Steve D'Aprano wrote: I don't think that's right. The entropy of a single message is a well-defined quantity, formally called the self-information. https://en.wikipedia.org/wiki/Self-information True, but it still depends on knowing (or assuming) the probability of getting that particular me

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Stefan Ram wrote: Well, then one can ask about the entropy of a data source that only is emitting this message. You can, but it's still the *source* that has the entropy, not the message. (And the answer in that case is that the entropy is zero. If there's only one possible message you can

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:32 PM, Chris Angelico wrote: > On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing > wrote: >> You're missing something fundamental about what >> entropy is in information theory. >> >> It's meaningless to talk about the entropy of a single >> message. Entropy is a function o

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing wrote: > You're missing something fundamental about what > entropy is in information theory. > > It's meaningless to talk about the entropy of a single > message. Entropy is a function of the probability > distribution of *all* the messages you might

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Steve D'Aprano wrote: Random data = any set of data generated by "a source of random". Any set of data generated by Grant Thompson? https://www.youtube.com/user/01032010814 -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
danceswithnumb...@gmail.com wrote: 10101011 This equals 61611 This can be represented using 0-6 log2(7)*5= 14.0367746103 bits 11010101 This equals 54543 This can be represented using 0-5 log2(6)*5= 12.9248125036 bits You're missing something fundamental about what entropy is

Re: Coding style in CPython implementation

2017-10-28 Thread Dan Sommers
On Sat, 28 Oct 2017 16:20:54 -0700, Στέφανος Σωφρονίου wrote: > I do believe though that if (!d) is a lot clearer than if (d == NULL) > as it is safer than falsely assigning NULL in d, by pure mistake. Having made my living writing C code for a very long time, I always found if (!d) *harder* to r

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Ben Bacarisse wrote: But that has to be about the process that gives rise to the data, not the data themselves. If I say: "here is some random data..." you can't tell if it is or is not from a random source. I can, as a parlour trick, compress and recover this "random data" because I chose it

Re: Compression of random binary data

2017-10-28 Thread Ian Kelly
On Oct 28, 2017 10:30 AM, "Stefan Ram" wrote: > Well, then one can ask about the entropy of a data source > thatt only is emitting this message. (If it needs to be endless: > thatt only is emitting this message repeatedly.) If there is only one possible message then the entropy is zero. -1.0 * l

Re: Compression of random binary data

2017-10-28 Thread Steve D'Aprano
On Sun, 29 Oct 2017 07:03 am, Peter Pearson wrote: > On Thu, 26 Oct 2017 19:26:11 -0600, Ian Kelly wrote: >> >> . . . Shannon entropy is correctly calculated for a data source, >> not an individual message . . . > > Thank you; I was about to make the same observation. When > people talk about t

Re: Repairing Python installation?

2017-10-28 Thread Percival John Hackworth
On 28-Oct-2017, Martin Schöön wrote (in article ): > It seems something is amiss with my Python 2.7 installation. Revisiting > Nikola (static web site generator written in Python) for the first time > in several years the other day I experience some unexpected problems. I > got some help form the

Re: Coding style in CPython implementation

2017-10-28 Thread Στέφανος Σωφρονίου
On Saturday, October 28, 2017 at 9:54:30 PM UTC+3, bartc wrote: > On 28/10/2017 19:42, Στέφανος Σωφρονίου wrote: > > Greetings everyone. > > > > I have noticed that in many if conditions the following syntax is used: > > > > a) if (variable == NULL) { ... } > > b) if (variable == -1) { ... } > >

Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Cameron Simpson
On 28Oct2017 23:56, Piet van Oostrum wrote: I am using Python 2.7.14 on MacOS Sierra. I have a small Python program that calls a shell script in a loop with a time.sleep() in it. The shell script is called with subprocess.Popen(), followed by a subprocess.wait(). No information is exchanged w

Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Cameron Simpson
On 29Oct2017 10:11, Cameron Simpson wrote: It may be a bug. Or it may be a system call which cannot be meaningfulling retried. But had you considered only activating the handler around the sleep? You still need to copy with SIGINT single I infer that you send this from outside the program.

Re: Problem with subprocess.Popen and EINTR

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 8:56 AM, Piet van Oostrum wrote: > I am using Python 2.7.14 on MacOS Sierra. > > I have a small Python program that calls a shell script in a loop with a > time.sleep() in it. > The shell script is called with subprocess.Popen(), followed by a > subprocess.wait(). > No in

Problem with subprocess.Popen and EINTR

2017-10-28 Thread Piet van Oostrum
I am using Python 2.7.14 on MacOS Sierra. I have a small Python program that calls a shell script in a loop with a time.sleep() in it. The shell script is called with subprocess.Popen(), followed by a subprocess.wait(). No information is exchanged with the shell script. Once in a while I send a

Re: Repairing Python installation?

2017-10-28 Thread Karsten Hilbert
On Sat, Oct 28, 2017 at 08:41:34PM +, Martin Schöön wrote: > It seems something is amiss with my Python 2.7 installation. Revisiting > Nikola (static web site generator written in Python) for the first time > in several years the other day I experience some unexpected problems. I > got some he

Re: Coding style in CPython implementation

2017-10-28 Thread Ned Batchelder
On 10/28/17 4:26 PM, Stefan Ram wrote: Ned Batchelder writes: On 10/28/17 3:00 PM, Stefan Ram wrote: =?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?= writes: What I wanted to ask is, is there a particular reason for not choosing definition of »NULL«. »NULL« is not part of the

Repairing Python installation?

2017-10-28 Thread Martin Schöön
It seems something is amiss with my Python 2.7 installation. Revisiting Nikola (static web site generator written in Python) for the first time in several years the other day I experience some unexpected problems. I got some help form the Nikola people and the conclusion is something is broken with

Re: Coding style in CPython implementation

2017-10-28 Thread Ned Batchelder
On 10/28/17 3:00 PM, Stefan Ram wrote: =?UTF-8?B?zqPPhM6tz4bOsc69zr/PgiDOo8+Jz4bPgc6/zr3Or86/z4U=?= writes: What I wanted to ask is, is there a particular reason for not choosing I am not a CPython developer, but here are my 2 cents about the possibilities: if (variable == NULL) { ...

Re: Compression of random binary data

2017-10-28 Thread Peter Pearson
On Thu, 26 Oct 2017 19:26:11 -0600, Ian Kelly wrote: > > . . . Shannon entropy is correctly calculated for a data source, > not an individual message . . . Thank you; I was about to make the same observation. When people talk about the entropy of a particular message, you can bet they're headed

Re: Ide vs ide

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 6:10 AM, Stefan Ram wrote: > Rustom Mody writes: >>Useful python programs are often small; even tiny > > We must not forget that tiny programs are just large > problems with the size masterfully hidden. > > For example, the »print« of Python is actually implemented >

Re: Coding style in CPython implementation

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 5:42 AM, Στέφανος Σωφρονίου wrote: > Greetings everyone. > > I have noticed that in many if conditions the following syntax is used: > > a) if (variable == NULL) { ... } > b) if (variable == -1) { ... } > c) if (variable != NULL) { ... } > > What I wanted to ask is, is ther

Re: Coding style in CPython implementation

2017-10-28 Thread bartc
On 28/10/2017 19:42, Στέφανος Σωφρονίου wrote: Greetings everyone. I have noticed that in many if conditions the following syntax is used: a) if (variable == NULL) { ... } b) if (variable == -1) { ... } c) if (variable != NULL) { ... } What I wanted to ask is, is there a particular reason for

Coding style in CPython implementation

2017-10-28 Thread Στέφανος Σωφρονίου
Greetings everyone. I have noticed that in many if conditions the following syntax is used: a) if (variable == NULL) { ... } b) if (variable == -1) { ... } c) if (variable != NULL) { ... } What I wanted to ask is, is there a particular reason for not choosing a) if (!variable) { ... } in place

Re: What use is of this 'cast=float ,'?

2017-10-28 Thread Rick Johnson
On Friday, October 27, 2017 at 3:35:45 PM UTC-5, Robert wrote: > I read below code snippet on line. I am interested in the > second of the last line: `cast=float`. I've tried it in > Python. Even simply with: `float` It has no error, but what > use is it? > > self.freqslider=forms.slider( >

sys.path[] question

2017-10-28 Thread ElChino
From the Python2.7 snippet in [1], Python2.7 reports that my sys.path[] contains: f:\ProgramFiler\Python27\lib\site-packages\pyreadline-2.0-py2.7-win32.egg (a .zip-file) But I have also a 'f:\ProgramFiler\Python27\lib\site-packages\pyreadline' directory. With the complete package AFAICS. So m

Re: Ide vs ide

2017-10-28 Thread Andrew Z
I like this trajectory of conversation. Can we re define "small tiny" as "scripts"? i can argue, based on my expirience with other languages, that there is no need for an "ide". The most ive ever needed is a text editor and a few plugins with "print". Moving to "average" size projects. What i fou

Re: Compression of random binary data

2017-10-28 Thread Ben Bacarisse
Steve D'Aprano writes: > On Fri, 27 Oct 2017 09:53 am, Ben Bacarisse wrote: > >> A source of random can be defined but "random data" is much more >> illusive. > > Random data = any set of data generated by "a source of random". (I had an editing error there; it should be "a source of random data

Re: Python noob having a little trouble with strings

2017-10-28 Thread William Ray Wing
OSX has been shipping with Python 2.7 for several years. I’m not sure why you are seeing 2.6. Bill > On Oct 27, 2017, at 2:48 AM, Lutz Horn wrote: > > On Thu, Oct 26, 2017 at 07:59:10PM -0700, randyli...@gmail.com wrote: >> Hi Bob, thanks for responding. I'm not sure where to do so, my >> pro

EuroPython 2017: Videos for Friday available online

2017-10-28 Thread M.-A. Lemburg
We are pleased to announce the last batch of cut videos for EuroPython 2017. * All 163 EuroPython 2017 videos are now online * To see the new videos, please head over to our EuroPython YouTube channel and select the "EuroPython 2017" playlist. The new videos start at entry 129 in the p

Re: Compression of random binary data

2017-10-28 Thread Steve D'Aprano
On Fri, 27 Oct 2017 09:53 am, Ben Bacarisse wrote: > A source of random can be defined but "random data" is much more > illusive. Random data = any set of data generated by "a source of random". -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, thing

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-28 Thread David Gabriel
I forget to precise that I am using pycharm. And this issue is reproducible also using command line to run the code. Best regards 2017-10-28 14:31 GMT+02:00 David Gabriel : > Thanks so Lutz much for your reply. > I am using python2.7 and I am running this code in an Openstack instance. > I will

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-28 Thread David Gabriel
Thanks so Lutz much for your reply. I am using python2.7 and I am running this code in an Openstack instance. I will apply your recommandation and let you know about the result ... Kind regards. 2017-10-27 16:13 GMT+02:00 Lutz Horn : > On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrot

ANN: distlib 0.2.6 released on PyPI

2017-10-28 Thread Vinay Sajip via Python-list
I've just released version 0.2.6 of distlib on PyPI [1]. For newcomers,distlib is a library of packaging functionality which is intended to beusable as the basis for third-party packaging tools. The main changes in this release are as follows: * Fixed #99: Updated to handle a case where sys.getfi

Re: Ide vs ide

2017-10-28 Thread Rustom Mody
On Saturday, October 28, 2017 at 4:46:03 PM UTC+5:30, Christian Gollwitzer wrote: > Am 28.10.17 um 09:04 schrieb Rustom Mody: > > [The other day I was writing a program to split alternate lines of a file; > > Apart from file-handling it was these two lines: > > > > for x in lines[0::2]: pr

Re: Ide vs ide

2017-10-28 Thread Christian Gollwitzer
Am 28.10.17 um 09:04 schrieb Rustom Mody: [The other day I was writing a program to split alternate lines of a file; Apart from file-handling it was these two lines: for x in lines[0::2]: print(x.strip()) for x in lines[1::2]: print(x.strip()) ] ...and using the best(TM) tool for

testfixtures 5.3.0 released!

2017-10-28 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 5.3.0 featuring the following: * Add pytest traceback hiding for|TempDirectory.compare()|. * Add warnings that|log_capture()|,|tempdir()|and|replace()|are not currently compatible with pytest’s fixtures mechanism. * Better suppo

Re: Keep or drop index.html from Django?

2017-10-28 Thread Thomas Jollans
On 28/10/17 08:55, Christopher Reimer wrote: > Greetings, > > When I set up my static website using Pelican several years ago, many URLs > ended with index.html. Now that I'm looking at Django, I got a small set of > URLs working with and without index.html to point to the correct pages. > > I

Re: Ide vs ide

2017-10-28 Thread Rustom Mody
On Saturday, October 28, 2017 at 11:59:14 AM UTC+5:30, Andrew Z wrote: > Yeah, lets start the war! > // joking! > > But if i think about it... there are tons articles and flame wars about "a > vs b". > And yet, what if the question should be different: > > If you were to create the "ide" for your