list comprehension question
Johann Spies
johann.spies at gmail.com
Wed Feb 29 08:52:50 EST 2012
I understand the following:
In [79]: instansie
instansie
Out[79]: 'Mangosuthu Technikon'
In [80]: t = [x.alt_name for x in lys]
t = [x.alt_name for x in lys]
In [81]: t
t
Out[81]: []
In [82]: t.append(instansie)
t.append(instansie)
In [83]: t
t
Out[83]: ['Mangosuthu Technikon']
But then why does the following behave like this:
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
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120229/8da6d876/attachment.html>
More information about the Python-list
mailing list