# this works, but see below
# allTheLists = 
# for j in range(int(L)):
# allTheLists[j] = 
# more pythonic:
allTheLists = [ for x in range(int(L))]
It is very difficult or error prone to do assignment to list elements so often I prefer to use dicts.
# elements of list are mutable and can be variable reference, not values
allthelists = [ for x in range(int(L))]
allthelists[j]=newitem ## wrong, or more dangerous
##allthelists[j]=newitem[:] ## right, or safer, copy by [:], newitem does not change
allthelists[j].append(moreitem) ## changes newitem if not copy
print 'New item',newitem
newitem='ghi' ## in this case no problem as newitem overwriten
print allthelists ## element of allthelist did not change
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.