New submission from David Collins <[email protected]>:
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.
----------
assignee: terry.reedy
components: IDLE
messages: 342049
nosy: coldy028, terry.reedy
priority: normal
severity: normal
status: open
title: passing negative values through modules
type: compile error
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36872>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com