[Numpy-discussion] set operation

John Salvatier jsalvati at u.washington.edu
Tue Aug 17 10:44:48 EDT 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 at ou.edu> wrote:

> On Tue, Aug 17, 2010 at 9:11 AM, gerardob <gberbeglia at 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100817/18100a78/attachment.html>


More information about the NumPy-Discussion mailing list