Keep or drop index.html from Django?

2017-10-27 Thread Christopher Reimer
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 read somewhere that the Django philosophy was to keep the U

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

2017-10-27 Thread Lutz Horn
On Fri, Oct 27, 2017 at 03:56:39PM +0200, David Gabriel wrote: > from packaging import version as pack_version > ImportError: No module named packaging > > I googled it and I have found so many suggestions regarding updating > 'pip' and installing python-setuptools but all of these did not fix > t

Re: Python noob having a little trouble with strings

2017-10-27 Thread Lutz Horn
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 > professor had us download Pycharm for mac's which uses python 2.6 The code from your question is not specific to Python 2 or 3. Just try it in the Python install

Re: SciPy 1.0 released!

2017-10-27 Thread Paul Dubois
The DNA of this work goes much further back. After some discussion as mentioned, Jim Hugunin wrote a numerical extension (called Numerical) and after a bit I took over as its coordinator with financial support for my work from Lawrence Livermore National Laboratory. They also supported the Foundati

Ide vs ide

2017-10-27 Thread Andrew Z
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 yourself (think lego) , what are the functions that you _use_ and like a lot? -- https://m

Re: Python noob having a little trouble with strings

2017-10-27 Thread Naman Bhalla
I guess your professor just asked you to download Pycharm. It is just MacOS that happens to have Python 2.6 inbuilt. Had your professor actually wanted you to be using Python 2 (I doubt), that would have been 2.7. Regardless of that I recommend having latest Python 2 or 3 as per your requirement

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
On Oct 27, 2017 5:38 PM, "Ian Kelly" wrote: In addition to what others have answered, if the code in question has any variables then I'll prefer to put it inside a function and call the function. This ensures that the variables are local and not going. It's a minor code hygiene point, but a good

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
In addition to what others have answered, if the code in question has any variables then I'll prefer to put it inside a function and call the function. This ensures that the variables are local and not going. It's a minor code hygiene point, but a good practice in my opinion. -- https://mail.pytho

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

2017-10-27 Thread Tim Chase
[rearranging for easier responding] On 2017-10-27 13:35, Robert wrote: > self.freqslider=forms.slider( > parent=self.GetWin( ), > sizer=freqsizer, > value=self.freq, > callback= self.setfreq, > minimum=−samprate/2, > maximum=samprate/2, > num_steps=100, > st

Re: Speed Race between old and new version 'working with files'

2017-10-27 Thread Steve D'Aprano
On Sat, 28 Oct 2017 09:11 am, japy.ap...@gmail.com wrote: > import time > > avg = float(0) That should be written as avg = 0.0 or better still not written at all, as it is pointless. > # copy with WITH function and execute time > for i in range(500): > start = time.clock() time.clock()

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

2017-10-27 Thread Cameron Simpson
On 27Oct2017 15:56, David Gabriel wrote: I am running a python code that generates for me this error : from packaging import version as pack_version ImportError: No module named packaging I googled it and I have found so many suggestions regarding updating 'pip' and installing python-setuptool

Speed Race between old and new version 'working with files'

2017-10-27 Thread japy . april
import time avg = float(0) # copy with WITH function and execute time for i in range(500): start = time.clock() with open('q://my_projects/cricket.mp3', 'rb') as old, open('q://my_projects/new_cricket.mp3', 'wb') as new: for j in old: new.write(j) stop = time.cloc

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

2017-10-27 Thread edmondo . giovannozzi
Il giorno venerdì 27 ottobre 2017 22:35:45 UTC+2, Robert ha scritto: > Hi, > > 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? >

Re: Just a quick question about main()

2017-10-27 Thread Ned Batchelder
On 10/27/17 2:05 PM, ROGER GRAYDON CHRISTMAN wrote: While teaching my introductory course in Python, I occasionally see submissions containing the following two program lines, even before I teach about functions and modules: if __name__ = '__main__': ... main() When I ask about it, I hear thin

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

2017-10-27 Thread Robert
Hi, 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? I do see a space before the comma ','. Is it a typo or not? Thanks, self.freqslider=forms.sli

PEP Post-History

2017-10-27 Thread Barry Warsaw
We’ve made a small change to the PEP process which may affect readers of python-list and python-ideas, so I’d like to inform you of it. This change was made to PEP 1 and PEP 12. PEPs must have a Post-History header which records the dates at which the PEP is posted to mailing lists, in order t

Re: Just a quick question about main()

2017-10-27 Thread Grant Edwards
On 2017-10-27, Chris Angelico wrote: > On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: >> While teaching my introductory course in Python, I occasionally see >> submissions containing the following two program lines,[...] >> if __name__ = '__main__': >> ... main() > If it's JUS

Re: Compression of random binary data

2017-10-27 Thread Ian Kelly
On Thu, Oct 26, 2017 at 8:48 PM, wrote: > Shouldn't that be? > > py> 16 * (-7/16 * math.log2(7/16) - 6/16 * math.log2(6/16)) = No, that's failing to account for 3/16 of the probability space. -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2017-10-27 Thread Ian Kelly
On Thu, Oct 26, 2017 at 8:19 PM, wrote: > It looks like that averages my two examples. I don't know how you can look at two numbers and then look at a third number that is larger than both of them and conclude it is the average. > H by the way that equation is really coolwhy does it ret

Re: Just a quick question about main()

2017-10-27 Thread Thomas Jollans
On 27/10/17 20:05, ROGER GRAYDON CHRISTMAN wrote: > While teaching my introductory course in Python, I occasionally see > submissions containing the following two program lines, even before > I teach about functions and modules: > > if __name__ = '__main__': > ... main() > > When I ask about it,

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 5:23 AM, Chris Angelico wrote: > On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: >> While teaching my introductory course in Python, I occasionally see >> submissions containing the following two program lines, even before >> I teach about functions and mod

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote: > While teaching my introductory course in Python, I occasionally see > submissions containing the following two program lines, even before > I teach about functions and modules: > > if __name__ = '__main__': > ... main() > > When I

Just a quick question about main()

2017-10-27 Thread ROGER GRAYDON CHRISTMAN
While teaching my introductory course in Python, I occasionally see submissions containing the following two program lines, even before I teach about functions and modules: if __name__ = '__main__': ... main() When I ask about it, I hear things like they got these from other instructors, or from

Re: Python noob having a little trouble with strings

2017-10-27 Thread Chris Angelico
On Sat, Oct 28, 2017 at 1:14 AM, Christopher Reimer wrote: > On Oct 27, 2017, at 1:49 AM, Peter J. Holzer wrote: >> >> BTW, I find it hard to believe that PyCharm for the Mac "comes with" >> Python 2.6. Python 2.6 is quite old. The Linux version isn't bundled >> with a python interpreter and just

Re: psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread Karsten Hilbert
On Fri, Oct 27, 2017 at 08:35:20AM -0700, maheshyadav1...@gmail.com wrote: > I am using 'psycopg2' library to access my PostgreSQL database from a python. > I want to pass a variable input in psql query something like this :- > > psql>>\set my_user table1 > psql>>select * from :my_user limit 10

psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread maheshyadav1771
Hello, I am using 'psycopg2' library to access my PostgreSQL database from a python. I want to pass a variable input in psql query something like this :- psql>>\set my_user table1 psql>>select * from :my_user limit 10; So I am just running these sql commands and getting this error :- >>> cur.

Re: Python noob having a little trouble with strings

2017-10-27 Thread Christopher Reimer
On Oct 27, 2017, at 1:49 AM, Peter J. Holzer wrote: > > BTW, I find it hard to believe that PyCharm for the Mac "comes with" > Python 2.6. Python 2.6 is quite old. The Linux version isn't bundled > with a python interpreter and just uses whatever is already installed on > the machine. I guess it'

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

2017-10-27 Thread David Gabriel
Dears, I am running a python code that generates for me this error : from packaging import version as pack_version ImportError: No module named packaging I googled it and I have found so many suggestions regarding updating 'pip' and installing python-setuptools but all of these did not fix this

Re: How to plot

2017-10-27 Thread Andrew Z
Rrhank you Thomas. On Oct 27, 2017 04:23, "Thomas Jollans" wrote: > On 2017-10-27 07:18, Andrew Z wrote: > > Hello, > > i'd like to create a graph/plot based a DB table's data, but not sure > > where to start. I > > > > also would like to have the following functionality: > > a. i'd like to

headless python app for android/ios

2017-10-27 Thread Robin Becker
In the past we have developed reportlab applications for use on android/ios devices. We used Kivy for the gui and the kivy setup did allow us to create a working reportlab pdf producer under the kivy gui. It was not exactly easy, but in the end we had a working PDF producer. A possible require

Re: Compression of random binary data

2017-10-27 Thread Ben Bacarisse
Marko Rauhamaa writes: > Ben Bacarisse : > >>> In this context, "random data" really means "uniformly distributed >>> data", i.e. any bit sequence is equally likely to be presented as >>> input. *That's* what information theory says can't be compressed. >> >> But that has to be about the process

Re: Python noob having a little trouble with strings

2017-10-27 Thread Peter J. Holzer
On 2017-10-27 02:59, randyli...@gmail.com wrote: > On Thursday, October 26, 2017 at 7:41:10 PM UTC-7, boB Stepp wrote: >> On Thu, Oct 26, 2017 at 9:25 PM, wrote: [...] >> Why not find out for yourself and print these in the Python >> interpreter? For instance: >> >> > py >> Python 3.6.2 (v3.6.

Re: How to plot

2017-10-27 Thread Thomas Jollans
On 2017-10-27 07:18, Andrew Z wrote: > Hello, > i'd like to create a graph/plot based a DB table's data, but not sure > where to start. I > > also would like to have the following functionality: > a. i'd like to have it in the separate window ( xwindow to be precise). > b. and i'd like to have

Re: Let's talk about debuggers!

2017-10-27 Thread Robin Becker
On 25/10/2017 15:08, Michele Simionato wrote: pdb plus plus: https://pypi.python.org/pypi/pdbpp I like the idea, but in putty at least changing the terminal size causes pdb++ to detach immediately from the process and mess up the screen. I think this is caused by (5, 'Input/output error') here