This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author coldy028
Recipients coldy028, terry.reedy
Date 2019-05-10.03:15:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557458116.02.0.0587666073886.issue36872@roundup.psfhosted.org>
In-reply-to
Content
program_data.py file contains a list 

import list_function
 
str_list4 = ['i', 't']
str_list4 = list_function.insert_value(str_list4, 's', -1)
print(str_list4)


list_function.py file 

def insert_value(my_list, value, insert_position):
    counter = 0
    print('Question 5')
    print(my_list, value, insert_position)
    for index in my_list:
        counter += 1

when passing the negative number in insert_position between the two modules this causes

 str_list4 = list_function.insert_value(str_list4, 's', -1)

  File "D:\part A\list_function.py", line 85, in insert_value
    for index in my_list:

TypeError: 'NoneType' object is not iterable

my_list now becomes lost, if the negative value is changed to positive this clears up . 

if you assign the -1 to a variable or a contstant it does not matter 
it still causes the same issue. 

however if you are running this code in the same module it works fine. this only seems to appear when attempting to pass between 2 modules a negative number.
History
Date User Action Args
2019-05-10 03:15:16coldy028setrecipients: + coldy028, terry.reedy
2019-05-10 03:15:16coldy028setmessageid: <1557458116.02.0.0587666073886.issue36872@roundup.psfhosted.org>
2019-05-10 03:15:15coldy028linkissue36872 messages
2019-05-10 03:15:15coldy028create