list comprehension question

James Broadhead jamesbroadhead at gmail.com
Wed Feb 29 12:01:35 EST 2012


On 29 February 2012 13:52, Johann Spies <johann.spies at gmail.com> wrote:
> In [82]: t.append(instansie)
> t.append(instansie)
>
> In [83]: t
> t
> Out[83]: ['Mangosuthu Technikon']

> In [84]: t = [x.alt_name for x in lys].append(instansie)
> t = [x.alt_name for x in lys].append(instansie)
>
> In [85]: t
> t
>
> In [86]: type t
> type t
> -------> type(t)
> Out[86]: NoneType
>

You should note that in [82], you're not doing:
> t = t.append(instansie)

hth



More information about the Python-list mailing list