are these operations on list valid?

Ken ken at hotmail.com
Sat Oct 5 23:10:05 EDT 2002


Hi, just like to know if these are valid:

1:
Use:
var1 = "hello"
var2 = "world"
list = [var1, var2]

Instead of:
list = []
list.append(var1)
list.append(var2)
--------------------
2.
Use:
list=["hello", "world"]
if list==["hello", "world]: #comparing list with list without examining
through every element inside
  do something.....

Instead of:
list1=["hello", "world"]
if list[0]==list1[0] and list[1]==list1[1]:
  do something....
---------------------
Thanks







More information about the Python-list mailing list