On Thu, 27 Apr 2017 11:49:55 +0200
Peter Otten <__pete...@web.de> wrote:
> I'd like to bring to your attention the discard() method
>
> >>> s = {1, 2, 3}
> >>> s.discard(int(v))
> >>> s
> {2, 3}
>
> which allows you to avoid building the throwaway single-entry set.
Thank you Peter. I have been
Phil wrote:
> Another question I'm afraid.
>
> If I want to remove 1 from a set then this is the answer:
>
> set([1,2,3]) - set([1])
>
> I had this method working perfectly until I made a change to cure another
> bug.
>
> So, I have a set represented in the debugger as {1,2,3} and again I want
On 04/26/2017 06:33 PM, Phil wrote:
> Another question I'm afraid.
>
> If I want to remove 1 from a set then this is the answer:
>
> set([1,2,3]) - set([1])
>
> I had this method working perfectly until I made a change to cure another bug.
>
> So, I have a set represented in the debugger as {1,
On Thu, 27 Apr 2017 01:58:39 +
eryk sun wrote:
> That exception indicates you probably used set(int(num)) instead of
> either {int(num)} or set([int(num)]).
Thank you Eryl, you are correct. Problem solved.
--
Regards,
Phil
___
Tutor maillist -
On Wed, Apr 26, 2017 at 8:34 PM, Phil wrote:
> On Wed, 26 Apr 2017 18:56:40 -0600
> Mats Wichmann wrote:
>
>> On 04/26/2017 06:33 PM, Phil wrote:
>> > Another question I'm afraid.
>> >
>> > If I want to remove 1 from a set then this is the answer:
>> >
>> > set([1,2,3]) - set([1])
>> >
>> > I had
On Thu, Apr 27, 2017 at 1:34 AM, Phil wrote:
> I did try {int(num)} but that resulted in an error that said something along
> the lines of int not being iterable. I'll have another look at that idea.
That exception indicates you probably used set(int(num)) instead of
either {int(num)} or set([int
On Wed, 26 Apr 2017 18:56:40 -0600
Mats Wichmann wrote:
> On 04/26/2017 06:33 PM, Phil wrote:
> > Another question I'm afraid.
> >
> > If I want to remove 1 from a set then this is the answer:
> >
> > set([1,2,3]) - set([1])
> >
> > I had this method working perfectly until I made a change to
On Thu, Apr 27, 2017 at 12:33 AM, Phil wrote:
> Another question I'm afraid.
>
> If I want to remove 1 from a set then this is the answer:
>
> set([1,2,3]) - set([1])
You can also use set literals here, with the caveat that {} is
ambiguous, and Python chooses to make it an empty dict instead of a
On Wed, Apr 26, 2017 at 7:33 PM, Phil wrote:
> Another question I'm afraid.
>
> If I want to remove 1 from a set then this is the answer:
>
> set([1,2,3]) - set([1])
>
> I had this method working perfectly until I made a change to cure another bug.
>
> So, I have a set represented in the debugger
Another question I'm afraid.
If I want to remove 1 from a set then this is the answer:
set([1,2,3]) - set([1])
I had this method working perfectly until I made a change to cure another bug.
So, I have a set represented in the debugger as {1,2,3} and again I want to
remove the one. Only this ti
10 matches
Mail list logo