[Edu-sig] poking around in Py3k (recycling old algebra)

Scott David Daniels Scott.Daniels at Acm.Org
Thu May 28 18:21:44 CEST 2009


Scott David Daniels wrote:
> kirby urner wrote:
>> ... Hey, did you know Ellipsis is a new primitive object ...
> Actually, it has been around for quite a while.... [broken example]

Sorry, everybody, I started writing, tried the code, and editted the 
reply, rather than taking direct quotes.  In doing so, I slipped up.
I'm embarrassed enough that I'm going to re-post:

       >>> class Funny(object):
               def __getitem__(self, *args):
                   return args
       >>> psuedo_array = Funny()
       >>> psuedo_array[1, ..., 10]
       ((1, Ellipsis, 10),)
       >>> Ellipsis
       Ellipsis

Just to add some actual content: I believe this was first put in
to help out array processing and heavy computation projects.  The
biggest survivors / descendants of those projects are Scipy & Numpy.

By the way, Funny is actually a fairly useful class for experiments.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Edu-sig mailing list