Re: Best practice for opening files for newbies?

2014-09-18 Thread chris . barker
On Thursday, September 18, 2014 9:38:00 AM UTC-7, Chris Angelico wrote: > On Fri, Sep 19, 2014 at 2:19 AM, wrote: > > So: there are way too many ways to open a simple file to read or write a > > bit of text (or binary): > > open() > > Personally, I'd just use this, all the way through - and not

Re: Why `divmod(float('inf'), 1) == (float('nan'), float('nan'))`

2014-09-18 Thread chris . barker
On Wednesday, September 17, 2014 11:22:42 PM UTC-7, wxjm...@gmail.com wrote: > >>> 1e300*1e300 > > inf > > >>> exp(1e300) > > Traceback (most recent call last): > > File "", line 1, in > > OverflowError: math range error FWIW, numpy is a bit more consistent: In [89]: numpy.exp(1e300) Out[

Best practice for opening files for newbies?

2014-09-18 Thread chris . barker
Folks, I'm in the position of teaching Python to beginners (beginners to Python, anyway). I'm teaching Python2 -- because that is still what most of the code "in the wild" is in. I do think I"ll transition to Python 3 fairly soon, as it's not too hard for folks to back-port their knowledge, bu

Re: Python and Math

2014-05-21 Thread chris . barker
On Tuesday, May 20, 2014 5:51:27 AM UTC-7, Frank Millman wrote: > I used it to install IPython, with the following results. > > First I ran 'pip install ipython', which worked. > > Then I read the IPython docs, which gave the following command to install > > Notebook - > > 'pip install ip

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread chris . barker
On Friday, August 16, 2013 11:51:49 AM UTC-7, Steven D'Aprano wrote: > > The trick here is that numpy really is the "right" way to do this stuff. > Numpy does not have a monopoly on the correct algorithms for statistics > functions, indeed not -- in fact, a number of them are quite lame, either

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread chris . barker
On Friday, August 16, 2013 10:15:52 AM UTC-7, Oscar Benjamin wrote: > On 16 August 2013 17:31, wrote: > Although it doesn't mention this in the PEP, a significant point that > > is worth bearing in mind is that numpy is only for CPython, not PyPy, > > IronPython, Jython etc. See here for a rece

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread chris . barker
> > I am seeking comments on PEP 450, Adding a statistics module to Python's The trick here is that numpy really is the "right" way to do this stuff. I like to say: "crunching numbers in python without numpy is like doing text processing without using the string object" What this is really an