| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | #!/bin/env python | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # this works... | 
					
						
							| 
									
										
										
										
											2012-03-03 11:36:59 +04:00
										 |  |  | l = [[]] | 
					
						
							|  |  |  | l[0] += [1] | 
					
						
							| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # let's change the structure a bit... | 
					
						
							| 
									
										
										
										
											2012-03-03 11:36:59 +04:00
										 |  |  | l = ([],) | 
					
						
							| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | # now, this also works... | 
					
						
							| 
									
										
										
										
											2012-03-03 11:36:59 +04:00
										 |  |  | e = l[0] | 
					
						
							| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | e += [1] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # XXX and this fails... | 
					
						
							| 
									
										
										
										
											2012-03-03 11:36:59 +04:00
										 |  |  | l[0] += [1] | 
					
						
							| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # and here is how... | 
					
						
							|  |  |  | ## Traceback (most recent call last): | 
					
						
							|  |  |  | ##   File "F:\work\ImageGrid\cur\ImageGrid\src\test\python-bug.py", line 17, in <module> | 
					
						
							| 
									
										
										
										
											2012-03-03 11:36:59 +04:00
										 |  |  | ##     l[0][0] += [1] | 
					
						
							| 
									
										
										
										
											2012-03-03 02:24:13 +04:00
										 |  |  | ## TypeError: 'tuple' object does not support item assignment |