<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Op ma 27 aug. 2018 om 23:18 schreef James Lu <<a href="mailto:jamtlu@gmail.com">jamtlu@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">> As Matthew points out, you could use numpy.array. Or code your own<br>
> class, by providing __add__ and __iadd__ methods.<br>
> <br>>
>>> import numpy<br>
> >>> a = numpy.array([1, 2])<br>
> >>> b = numpy.array([3, 4])<br>
> >>> a + b<br>
> array([4, 6])<br>
> >>> a += b<br>
> >>> a<br>
> array([4, 6])</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">I could, but I don't think that justifies not having this functionality in python</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">standard. From the language experience perspective, numpy is often a</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">pain to install on most systems. If I'm designing card games and I</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">just want to run a quick monte carlo simulation, the experience should be</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">as smooth as possible.</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">This is something I think most students will expect while learning python,</div><div style="font-family:arial,helvetica,sans-serif;font-size:small;color:#000000">especially if they're implementing algorithms.<br></div></div></blockquote><div><br></div><div>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. </div><div><br></div><div>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. </div><div> </div></div></div>