[Numpy-discussion] set operation

John Salvatier jsalvati@u.washington....
Tue Aug 17 09:44:48 CDT 2010


It should be noted that the 'set' type is a basic Python type, and not a
NumPy specific type.

On Tue, Aug 17, 2010 at 7:30 AM, Benjamin Root <ben.root@ou.edu> wrote:

> On Tue, Aug 17, 2010 at 9:11 AM, gerardob <gberbeglia@gmail.com> wrote:
>
>>
>> I would like to create a set composed of the numbers 2,3,4,...49,50,51.
>> How
>> do i do?
>> Thanks.
>>
>
> Gerard,
>
> Well, you can easily create a list of those numbers like so:
>
> >>> a = range(2, 52)   # note, you have to go one past the last number you
> want
>
> Then, you can cast it as a set() object:
>
> >>> b = set(a)
>
> Does that help?
> Ben Root
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100817/18100a78/attachment.html 


More information about the NumPy-Discussion mailing list