I have problem with ghpython. help me please. - Grasshopper2024-03-28T12:53:35Zhttps://www.grasshopper3d.com/forum/topics/i-have-problem-with-ghpython-help-me-please?commentId=2985220%3AComment%3A1574342&feed=yes&xn_auth=noThank you! I understand :-)tag:www.grasshopper3d.com,2016-08-05:2985220:Comment:15770142016-08-05T07:35:14.212ZJagahttps://www.grasshopper3d.com/profile/Jaga
<p>Thank you! I understand :-)</p>
<p>Thank you! I understand :-)</p> because "dic_crvs[angs[i]]" i…tag:www.grasshopper3d.com,2016-08-01:2985220:Comment:15743422016-08-01T16:03:28.653ZAlik Suminhttps://www.grasshopper3d.com/profile/AlikSumin
<p>because "<span>dic_crvs[angs[i]]" is a key of dictionary and when you write "dict[key]=..." it's mean that u want change a value for this key, not add new item to list. for example: <br/>dict = {a:[1,2], b:[]}<br/>dict[a] = [3]</span></p>
<p><span>your dict will be {a:[3], b:[]}</span></p>
<p><span>besides <span>dic_crvs[angs[i]].append(crvs[i]) is not an item, if you print this, you will see "None", because it's like an action.</span></span></p>
<p>because "<span>dic_crvs[angs[i]]" is a key of dictionary and when you write "dict[key]=..." it's mean that u want change a value for this key, not add new item to list. for example: <br/>dict = {a:[1,2], b:[]}<br/>dict[a] = [3]</span></p>
<p><span>your dict will be {a:[3], b:[]}</span></p>
<p><span>besides <span>dic_crvs[angs[i]].append(crvs[i]) is not an item, if you print this, you will see "None", because it's like an action.</span></span></p> wow.. Thank you! it works.
S…tag:www.grasshopper3d.com,2016-08-01:2985220:Comment:15744322016-08-01T15:07:37.463ZJagahttps://www.grasshopper3d.com/profile/Jaga
<p>wow.. Thank you! it works.</p>
<p></p>
<p>So, if you okay, could you teach me why "dic_crvs[angs[i]] = dic_crvs[angs[i]].append(crvs[i])" is a wrong sentence? </p>
<p>wow.. Thank you! it works.</p>
<p></p>
<p>So, if you okay, could you teach me why "dic_crvs[angs[i]] = dic_crvs[angs[i]].append(crvs[i])" is a wrong sentence? </p> you have an error because lin…tag:www.grasshopper3d.com,2016-08-01:2985220:Comment:15741772016-08-01T09:32:21.174ZAlik Suminhttps://www.grasshopper3d.com/profile/AlikSumin
<p>you have an error because line 25 is incorrect, you need use <br/>dic_crvs[angs[i]].append(crvs[i])<br/>instead<br/>dic_crvs[angs[i]] = dic_crvs[angs[i]].append(crvs[i]<br/>but you also need change the logic of your code, because when you use set, you change the order of elements in list (set doesn't have an order), therefore angles and curves in lists not corresponding with each other. </p>
<p>you have an error because line 25 is incorrect, you need use <br/>dic_crvs[angs[i]].append(crvs[i])<br/>instead<br/>dic_crvs[angs[i]] = dic_crvs[angs[i]].append(crvs[i]<br/>but you also need change the logic of your code, because when you use set, you change the order of elements in list (set doesn't have an order), therefore angles and curves in lists not corresponding with each other. </p>