On Jul 12, 12:18 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> It relies on positional arguments, tuple unpacking and
> the signature of zip(),
It moreso relies on the fact that:
>>> t1 = (0,1,2,3)
>>> t2 = (7,6,5,4)
>>> [t1, t2] == zip(*zip(t1, t2))
True
This is mathematically true given the d
Hi all,
Had a simple problem that turned into an interesting solution and I
thought I would share it here.
I had a list of tuples that I needed to get the first value from and
generate a list.
tuple_list = (
('John', 'Doe'),
('Mark', 'Mason'),
('Jeff', 'Stevens'),
('Bat', 'Man')
On Jul 10, 6:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> > my_list = ['a', 'b', 'c', 'd', 'e']
> > dup_map = {}
> > for item in my_list:
> > dup_map[item] = True
>
> > # ... sometime later
>
> > for complex_dict in large_list:
> > if complex_dict["char"] not in dup_map:
> >
Hi all,
Simple question really on a best practice. I want to avoid adding
duplicates to a list.
my_list = ['a', 'b', 'c', 'd', 'e']
dup_map = {}
for item in my_list:
dup_map[item] = True
# ... sometime later
for complex_dict in large_list:
if complex_dict["char"] not in dup_map: