[Python-ideas] Python-ideas Digest, Vol 141, Issue 145

Jacco van Dorp j.van.dorp at deonet.nl
Tue Aug 28 03:11:34 EDT 2018


Op ma 27 aug. 2018 om 23:18 schreef James Lu <jamtlu at gmail.com>:

> > As Matthew points out, you could use numpy.array. Or code your own
> > class, by providing __add__ and __iadd__ methods.
> >
> > >>> import numpy
> > >>> a = numpy.array([1, 2])
> > >>> b = numpy.array([3, 4])
> > >>> a + b
> > array([4, 6])
> > >>> a += b
> > >>> a
> > array([4, 6])
>
> I could, but I don't think that justifies not having this functionality in
> python
> standard. From the language experience perspective, numpy is often a
> pain to install on most systems. If I'm designing card games and I
> just want to run a quick monte carlo simulation, the experience should be
> as smooth as possible.
>
> This is something I think most students will expect while learning python,
> especially if they're implementing algorithms.
>

To be really honest, if you want to run it as "smooth as possible" you'll
NEED numpy anyway. If you have an algoritmn of any significant mathematical
complexity, numpy's Fortran implementation will beat out pure python
easily. I don't have any experience with monte carlo simulations myself,
but if you're doing this any significant amount of times you'll be better
off creating a numpy array.

And personally I just grab Anaconda. It knows how to install wherever, and
includes numpy and a lot of other things you might need. If you want it
smooth, for beginners, that'd be my first recommendation. (Actually, I
started using it because I had trouble installing numpy stack on a new
system back when I was a noob.) Most students learning python will probably
be on windows, so just down loading an installer and clicking through it
should be more than familiar for them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180828/5ea2c5a8/attachment.html>


More information about the Python-ideas mailing list